- Home /
Need help with LookAt - Object flipping
Hi there,
I have a gun that I need to rotate around the Z axis and follow the mouse. I have tried so many different methods and they all work, apart from one thing. When the mouse crosses the Y axis above or below the gun, the 3D gun model flips 180 degrees on the Y to keep facing the target. I need it to rotate without flipping. It only does this when it crosses the Y axis.
I am not to good with this mathy type stuff... any ideas why this would be happening? As I said, I had many attempts and the most basic (LookAt) is probably the best way to go... I also tried Quaternion.LookRotation... same issue (I had thought it might be gimbal lock).
Any ideas?
I also tried locking the Y axis rotation on the rigid body, but it seems the script overlooks that.
Answer by POLYGAMe · Sep 11, 2012 at 03:48 AM
Looked a bit harder, found this:
http://answers.unity3d.com/questions/57407/making-and-object-rotate-with-mouse.html
Your answer
Follow this Question
Related Questions
Camera following/looking at aircraft 1 Answer
Object Look At Mouse 2 Answers
2D LookAt not working as intended 1 Answer
LookAt on one axis 2 Answers