- Home /
Drawing flat arrows
trying to draw arrows like http://wiki.unity3d.com/index.php?title=DrawArrow it mostly works... it is just that some of the arrows (only right above or below?) are not oriented so as to be visible
how can i 'flatten'/rotate them so they are visible like the others? please & thanks
private void ArrowGizmo(Vector2 child, Vector2 parent, Color c)
{
const float length = .05f;
const float angle = 20f;
Gizmos.color = c;
Vector2 d = (parent - child) * .5f;
Gizmos.DrawRay(child, d);
Vector3 right = Quaternion.LookRotation(d) * Quaternion.Euler(180 + angle, 0f, 0f) * Vector3.forward;
Vector3 left = Quaternion.LookRotation(d) * Quaternion.Euler(180 - angle, 0f, 0f) * Vector3.forward;
Gizmos.DrawRay(child + d, right * length);
Gizmos.DrawRay(child + d, left * length);
}
arrows.jpg
(54.2 kB)
Comment
Best Answer
Answer by rakkarage · Apr 06, 2014 at 10:01 PM
change both Quaternion.LookRotation(d) to Quaternion.LookRotation(d, Vector3.right) and it works. thanks
Your answer
Follow this Question
Related Questions
Want to move object slowly to where the mouse clicks? 1 Answer
Distribute terrain in zones 3 Answers
Dashing through enemies, but not walls. 1 Answer
First child of a gameobject 3 Answers
Locking gameobject to rotating floor 0 Answers