Change LookAt Face

Is it possible to somehow change the face of a GameObject that looks towards another GameObject, from what I can tell it’s normally the positive Z face, is it possible to say, make it be the positive Y face?

+Z is forward, though. you're going to keep running in to problems if you try to use some other axis as the forward element. if you're just doing a one-shot thing with +Y though, go for it

1 Answer

1

Yes just multiply transform.rotation by the Quaternion representing the change you require:

   transform.LookAt(something);
   transform.rotation = Quaternion.FromToRotation(Vector3.up, Vector3.forward) * transform.rotation;

Oh try transform.rotation = Quaternion.FromToRotation(Vector3.up, Vector3.forward) * Quaternion.LookRotation(something.position - transform.position, Vector3.up);