Question by
Super_Solomob422 · Jun 26, 2020 at 02:51 PM ·
c#rotationtransformclamp
Clamp transform.rotation?
I know that it's near impossible to clamp a quaternion. But how would I put a clamp in this code for the transform.rotation? Any method is fine. I put a comment "CLAMP TRANSFORM.ROTATION" where I was trying to put it. Thanks in advance if anyone helps.
Quaternion OriginalRot = transform.rotation;
transform.LookAt(otherObj.transform);
Debug.Log("Looking At Other.");
Quaternion NewRot = transform.rotation;
transform.rotation = OriginalRot;
transform.rotation = Quaternion.Lerp(transform.rotation, NewRot, (speed * Time.deltaTime) * 5);
//CLAMP TRANSFORM.ROTATION
Comment