1
\$\begingroup\$

Currently, we can draw rays in real time, like this:

Debug.DrawRay(transform.localPosition, _navAgent.desiredVelocity*3, Color.yellow);
Debug.DrawRay(transform.localPosition, transform.forward*2, Color.magenta);

Is there some way we can draw the angle between these two rays for real time visualization? I'd like to draw them in the viewport at the intersection of the two rays, instead of having to log it in the editor and trying to guess which angle was for which frame. For example, below we can see the viewport showing the above two rays, one is the navAgent's desiredVelocityVector(yellow) and the other the character's forward vector(magenta), I've drawn the angle construction I imagine I'd like to be able to view (in green): enter image description here

\$\endgroup\$
8
  • \$\begingroup\$ Sure, we can make our own convenience function that combines Debug.DrawLine calls to make any shape we want. What would you like the drawn angle to look like? \$\endgroup\$
    – DMGregory
    Jan 2, 2022 at 13:33
  • \$\begingroup\$ Like the usual angle symbol we see in mathematics, it would be visually appealing if it drew as an arc between the two rays \$\endgroup\$
    – BumbleBee
    Jan 2, 2022 at 14:37
  • \$\begingroup\$ So you want just a semi-circular arc between two rays, no numeric display? \$\endgroup\$
    – DMGregory
    Jan 2, 2022 at 14:59
  • 1
    \$\begingroup\$ no, a numeric display that goes with the arc would be best I think \$\endgroup\$
    – BumbleBee
    Jan 2, 2022 at 16:05
  • 1
    \$\begingroup\$ Then you should edit your question to show us an example of what you want it to look like. Otherwise it's ambiguous what outcome you want. \$\endgroup\$
    – DMGregory
    Jan 2, 2022 at 21:33

0

You must log in to answer this question.

Browse other questions tagged .