transform.TransformDirection(transform.forward) (0.0, 0.0, -1.0)

With the gameobject’s forward vector pointing to global positive x…

  1. transform.TransformDirection(Vector3.forward) outputs (1.0, 0.0, 0.0) … OK, understood.
  2. transform.TransformDirection(transform.forward) outputs (0.0, 0.0, -1.0) … Why?

Can someone explain why #2?

This line of code makes no sense. “TransformDirection” takes a local space direction vector as input. transform.forward is a worldspace direction.

Basically Those two lines are identical:

Vector3 fwd = transform.forward;

Vector3 fwd = transform.TransformDirection(Vector3.forward);

Your code does interprets a worldspace direction as localspace direction and transforms it again. The result will be nonsense.

So this line:

    transform.TransformDirection(transform.forward);

would be the same as doing

    transform.TransformDirection(transform.TransformDirection(Vector3.forward));