- Home /
Question by
unity_nQtfLJUMWJ_ePA · Feb 23, 2019 at 02:34 PM ·
rotationgimbal-lock
How can I make this work without gimbal lock?
This my current code:
void Update()
{
transform.Rotate(0, 0, RollForce * (float)rmove * Time.deltaTime);
transform.Rotate(0, YawForce * (float)ymove, 0 * Time.deltaTime);
transform.Rotate(PitchForce * (float)rmove, 0, 0 * Time.deltaTime);
}
Any ideas?
Comment
Answer by Bunny83 · Feb 23, 2019 at 03:10 PM
What do you mean? Each seperate Rotate instruction will rotate around the local axis of the object, one after another. There's no gimbal lock involved here. However you have your Time.deltaTime at the wrong parameter in the second and third line. You multiply the "0" by deltaTime which is completely pointless. Though your actual non-zero rotation value is not scaled by deltaTime.
Your answer
![](https://koobas.hobune.stream/wayback/20220612192315im_/https://answers.unity.com/themes/thub/images/avi.jpg)