Version: Unity 6 Preview (6000.0)
LanguageEnglish
  • C#

Rigidbody.rotation

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public Quaternion rotation;

Description

The rotation of the Rigidbody.

Use Rigidbody.rotation to get and set the rotation of a Rigidbody using the physics engine.

Changing the rotation of a Rigidbody using Rigidbody.rotation updates the Transform after the next physics simulation step. This is faster than updating the rotation using Transform.rotation, as Transform.rotation causes all attached Colliders to recalculate their rotation relative to the Rigidbody, whereas Rigidbody.rotation sets the values directly to the physics system.

If you want to continuously rotate a rigidbody use MoveRotation instead, which takes interpolation into account.

Note: rotation is world-space.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { GetComponent<Rigidbody>().rotation = Quaternion.identity; } }