- Home /
Debug.DrawLine or a better option?
For debugging, I would like to know how to project a line out of the direction of the player's z axis using Debug.Drawline, unless their is a better solution?
Since it is the purpose of it, I don't think there is any better solution. Note that it is quite simple to use, (start, end, color). Now if you want to draw on the game you need to use LineRenderer.
Debug.DrawLine(Vector3.zero, new Vector3(0, 0, 3), Color.red,60,false);
I agree. I've actually tried several ways to get it to display (and I've checked that my gizmos are on) but I'm not seeing anything in any direction.
Answer by robertbu · Apr 02, 2013 at 07:15 AM
This will draw a green line for 5 seconds in the forward direction of the player.
Debug.DrawLine(transform.position, transform.position + transform.forward * 10.0, Color.green, 5.0);
I'm assuming that is what you mean by "player's z axis".
Thanks again. Updated this for anyone who can use this also.
Debug.DrawLine(transform.position, transform.position + transform.forward * 10.0, Color.green, 5);
Your answer
Follow this Question
Related Questions
Debug.DrawLine multiple cameras issue 0 Answers
Converting Debug.drawlines to in-game lines? [screenshot inside] 3 Answers
What does direction do for a physics.raycast besides direction? (read details) 1 Answer
How to make curved Debug.DrawLine in game view using LineRenderer 0 Answers
Get raycast direction from weapon 1 Answer