Transform.up doesnt give me it´s local up position
When I write this:
Debug.DrawLine(firstPos.position, -firstPos.up * 5, Color.red, 1);
It doesn´t go to the actual up position from the game object. It goes to the origin´s up position.
How do I get the actual up position?
tankup.png
(117.7 kB)
Comment
Best Answer
Answer by TreyH · Mar 05, 2019 at 08:00 PM
Lines require start and end points, not points and directions:
Debug.DrawLine(firstPos.position, firstPos.position + firstPos.up * 5, Color.red, 1);
From Owen's comment, you already have the Debug.DrawRay syntax there, so you can alternatively just replace DrawLine
with DrawRay
:
Debug.DrawRay(firstPos.position, -firstPos.up * 5, Color.red, 1);
But note that raycasts work like what the OP wrote: a start position and a direction. Debug.DrawLine is just weird. You're almost always using it to test a raycast, or a velocity, but it works backwards from them.