Model Y-axis rotation only rotates on wrong axis

I have a model which will turn and look at the first person controller. However, I realized that it does not rotate on the correct axis when using LookAt

clownModel.transform.LookAt(Vector3(player.transform.position.x, clownModel.transform.position.y, player.transform.position.z));

Result :

The head is actually pointing at me. Which means X axis rotated instead of Y.

This code works for the rotation, however I realized it’s on the Z axis

clownModel.transform.Rotate(Vector3(0, 0, player.transform.position.z));

Thanks for any help :slight_smile:

Why do you use the y-coordinate of your clown model in the LookAt method call?

I’m thinking it should look like this:

  clownModel.transform.LookAt(player.transform);

Maybe the forward direction of your model isn’t correct imported. You can check this in the editor when you switch to Local coordinate system.

Also you can use for the LookAt methods a worldUp vector. Check the API docu for it ( http://docs.unity3d.com/ScriptReference/Transform.LookAt.html )

did the model come from blender? there are fixes for the different axis usages in unity/blender in the external tools forum