Rotation to direction vector?

How can I get a normalized direction vector from an objects rotation?

As @jimmyjjeeter suggested, you can use transform.forward (as well as transform.up for the up direction, transform.right for right, -transform.right for left etc.).

If you have a quaternion but not the transform, you can rotate a vector like this:

  var rotatedVector = someQuaternion * Vector3.forward;

NOTE: Order matters in the quaternion world: it must always be quaternion x vector (vector x quaternion produces an error).

I always end up here when I’ve forgotten how to convert a rotation to a direction vector, so here’s a complete answer for anyone else ending up here or for me 6 months from now.

For a Quaternion rotation:

Vector3 forwardVector = yourQuaternionRotation * Vector3.forward

And for a Vector3 rotation:

Vector3 forwardVector = Quaternion.Euler(yourVector3Rotation) * Vector3.forward

Isn’t that just transform.forward?