I planing rotate with vector. I did but Quaternion Gimbal Lock? rotating completely, I dont want it. transform.rotation = Quaternion.LookRotation(rotateVector.normalized) * Quaternion.FromToRotation(Vector3.down, Vector3.forward);
(Red Line Rotate Vector, Rotate x,y,z value -180 -90 0 90 -180 fliping I dont want it)
LookRotation interprets the vector as a direction and looks towards it. So (1, 0, 0) means look along the positive X axis, and (-1, 0, 0) means look along the negative X axis, they are opposite directions.
If you were trying to use a vector that says how many degrees to rotate around each axis, you should use Quaternion.Euler instead of Quaternion.LookRotation.
Of course, I’m not sure why you’d need to make your own vector for that, since that’s what the “rotation” fields on the Transform already do. What exactly are you trying to accomplish?
Quaternions do not have gimbals and therefore there is no gimbal lock. Only euler angles have gimbal lock. What you’re seeing has nothing to do with gimbal lock but with the fact that LookRotation actually takes 2 parameters and not one. Be default, if you only provide the forward vector, the second up vector is set to Vector3.up. This up vector is used to control the rotation around the forward vector. However if your forward vector does point up or down, your up vector is identical to the forward vector and therefore the resulting rotation around your forward vector would be undefined.
If you want to use LookRotation in a 360° environment you have to provide a meaningful up vector for your usecase.
You do know that LookRotation creates a rotation that rotates the forward vector from the identity rotation so that after the rotation it would point along your given vector. The up vector then just controls the rotation around that look vector. I’m not sure what’s the point of your strange 90° rotation around the local x axis which you add on top.
I Learned Now Quaternion didn’t have gimbal. I know it has the LookRotation 2 parameter but I didn’t know what the 2nd parameter is.
I designed the rotate vector as gravity, I designed it to take direction accordingly. The camera viewpoint changes as the rotation is fully rotated. So I can’t rotate the camera with localrotate. That’s why I asked. Fortunately, Bunny83 explained that LookRotation has 2 parameters and what it does. It seems that this problem was caused by the default value of the 2nd parameter, Vector.up. By doing Vector.zero this translation problem was fixed.