- Home /
gizmo.drawline question : point a to b
How do you get gizmo.drawline to not base off of the world axis, but the rotation of the object itself?
I'm trying to get it to cast only between a and b based off its own rotation and position. The engine is using the word axis and makes an infinite line.
Gizmos.DrawLine (transform.position, transform.right * dist);
thank you
Answer by robertbu · Jun 17, 2013 at 02:47 PM
Gizmos.DrawLine does not draw infinite lines. It draws a line from two specified points. To test, try this:
function OnDrawGizmos () {
Gizmos.color = Color.red;
Gizmos.DrawLine (Vector3(0,0,0), Vector3(1,0,0));
}
Which will draw a line 1 unity long starting at the origin. As for your code, what I think you want is:
Gizmos.DrawLine (transform.position, transform.position + transform.right * dist);
Answer by poncho · Jun 17, 2013 at 08:19 PM
if you want a gizmo of a finite or infinite line, you need to use rays, Gizmos.DrawRay, check the overloads of that method
Your answer
Follow this Question
Related Questions
Find gameobject furthest from player along z axis 0 Answers
Axis/Gizmo Translation Movement 0 Answers
Which Gizmo is Debug.DrawLine? 1 Answer
Spawn along local axis. 3 Answers
Whats the best way to get the Distance between two Vector3? 2 Answers