- Home /
Question by
Trild123787898 · Jan 18, 2020 at 03:00 PM ·
rotationrigidbodytransformscript.
object rotation with rigidbody component
how can I suppose, when I press a key, I rotate the object 30 degrees along the X axis, but using the rigidbody component when I’m on the object
Comment
Answer by lgarczyn · Jan 18, 2020 at 07:08 PM
In FixedUpdate:
Quaternion rotX30 = Quaternion.Euler(30, 0, 0);
rigidbody.MoveRotation(rotX30 * rigidbody.rotation);
See, it's pretty simple! The order of the multiplication is important though, always end with the most local rotation.
knocks out the following error: error CS0117: 'Vector3' does not contain a definition for 'Euler'