- Home /
Rotation Jitter When Assigning Rotation Around Y Axis
I have this snippet of code that is used to rotate a controller around the y axis and a child gameobject (the broom variable) around it's local x axis, all this happening while the object is flying.
//Controls Smooth Vertical Flying
vertLerp = 0.5f + (((Input.GetAxis("Vertical") / 2) * 100) * Time.smoothDeltaTime);
vertAngle = Mathf.Lerp(-45, 45, vertLerp);
//Rotates Character to Fly
angle += ((Input.GetAxis("Horizontal") * 85) * Time.smoothDeltaTime) * (((float)handling + 9) / 8.5f);
Quaternion broomRot = Quaternion.Euler(vertAngle, 0, 0);
transform.eulerAngles = new Vector3(0, angle, 0);
broom.transform.localRotation = Quaternion.Lerp(broom.transform.localRotation, broomRot, Time.smoothDeltaTime * 10);
Rotating the broom along its x axis works smoothly, but when turning the controller around its y axis, the broom seems to jitter while it turns. I have confirmed that it isn't the controller jittering, and messing around with the angle equation doesn't seem to change the jitter, so I'm not sure what I'm missing here. Any help or guidance is appreciated, thank you.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Add force problem 1 Answer
Distribute terrain in zones 3 Answers
How to make Rigidbody.AddForce less delayed in Unity3D? 0 Answers
Empty GameObjects fly away. 2 Answers