0

Given a Vector 3 of Euler Angles, how could one mathematically find the direction that object is facing.

In other words, how does Unity calculate the 'transform.forward' vector?

user3055557
  • 25
  • 1
  • 6
  • I'm voting to close this question as off-topic because it is about [math.se] instead of programming or software development. – Pang Aug 14 '17 at 03:45
  • The more correct way should be to convert the rotation to radians, then do what meowgoesthedog said. – khhs Feb 14 '21 at 08:14

1 Answers1

3

You should read up on spherical polar coordinates, noting the difference between conventional polar and Euler angles. But anyway the formula is (cos(pitch)cos(yaw), cos(pitch)sin(yaw), sin(pitch)). Note that the roll has no effect here.

meowgoesthedog
  • 14,670
  • 4
  • 27
  • 40