transform.lookat is not working correctly
i have a machin gun and i want that it to face the character and shoot him
transform.LookAt(player.position);
all is working but the problem that the machin gun is not facing the player but it aim's to the right side
my problem is like this guy problem so how to fix this :
https://www.youtube.com/watch?v=9DgkXhaHK1A
i have tryed many things but any is working like this one : transform.LookAt(player.position, worldUp: Vector3.forward);
transform.LookAt(player.position);
transform.LookAt
always works perfectly. YOU did something wrong, and with that few information, it will be impossible to help you.
First, make sure your machine gun model is correctly oriented (the barrel must be parallel to the +Z blue axis in local space), then check if you have a parent with a Y
rotation value set to -90 or 90 degrees.
Your answer
Follow this Question
Related Questions
Unity 2D lookat and shoot issues 0 Answers
Trouble with Rotations and Transform.LookAt() (I think!) 1 Answer
Creating a Window - Camera movement 0 Answers
Face object top to camera or Keep current top with LookAt 0 Answers
Restrict my tank gun rotation. 0 Answers