Question by
theDopplerEffect · Mar 16, 2019 at 12:56 AM ·
c#vector3quaternionvelocityangles
How to get local angle of travel
I'm currently using
transform.rotation.eulerAngles.y - Quaternion.LookRotation(new Vector3 (GetComponent<Rigidbody>().velocity.x, 0, GetComponent<Rigidbody>().velocity.z), Vector3.up).eulerAngles.y
to get the relative angle of travel on the y-axis.
This is personally janky and I think there are some better ways to do this in unity, but I'm having trouble finding anything better. Any ideas?
I also think there are some big bugs with the math because I need to exclude the calculation when the velocity vector is 0,0,0.
Comment
Your answer
Follow this Question
Related Questions
Look rotation viewing vector is zero 1 Answer
Vector3 magnitude broken? 1 Answer
How to get the angle to animate the player when running? 0 Answers
Grappling hook physics script error 0 Answers