Rigidbody.MoveRotation Manual     Reference     Scripting  
Scripting > Runtime Classes > Rigidbody
Rigidbody.MoveRotation

function MoveRotation (rot : Quaternion) : void

Description

Rotates the rigidbody to rotation.

For kinematic rigidbodies it applies friction based on the motion of the rigidbody. This lets you simulate moving / rotating platforms with rigidbodies sitting on top of the elevator. If you want other rigidbodies to interact with the kinematic rigidbody you need to move it in the FixedUpdate function.

JavaScripts
var eulerAngleVelocity : Vector3 = Vector3 (0, 100, 0);
function FixedUpdate () {
var deltaRotation : Quaternion = Quaternion.Euler(eulerAngleVelocity * Time.deltaTime);
rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
public Vector3 eulerAngleVelocity = new Vector3(0, 100, 0);
void FixedUpdate() {
Quaternion deltaRotation = Quaternion.Euler(eulerAngleVelocity * Time.deltaTime);
rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

public eulerAngleVelocity as Vector3 = Vector3(0, 100, 0)

def FixedUpdate():
deltaRotation as Quaternion = Quaternion.Euler((eulerAngleVelocity * Time.deltaTime))
rigidbody.MoveRotation((rigidbody.rotation * deltaRotation))