If I want to make on object look at a particular direction, I do
transform.LookAt(theDirection);
How do I retrieve the LookAt direction of the transform?
Edit:How do I retrieve the LookAt position of the transform?
If I want to make on object look at a particular direction, I do
transform.LookAt(theDirection);
How do I retrieve the LookAt direction of the transform?
Edit:How do I retrieve the LookAt position of the transform?
A couple of things here. Transform.LookAt() looks at a position in 3D space. It does not look in a specific direction. If you have a direction you want to look you can either do something like:
transform.LookAt(transform.postion + theDirection);
Or you can do:
transform.rotation = Quaternion.LookRotation(theDiretion);
As for the look direction of the transform, LookAt() points positive ‘Z’ towards the point, so the direction will be ‘transform.forward’.