Version: 2017.2
public void MoveRotation (Quaternion rot);

Parámetros

rot La nueva rotación para el Rigidbody.

Descripción

Rota el Rigidbody con una rotación rotation.

Use Rigidbody.MoveRotation to rotate a Rigidbody, complying with the Rigidbody's interpolation setting.

If Rigidbody interpolation is enabled on the Rigidbody, calling Rigidbody.MoveRotation will resulting in a smooth transition between the two positions in any intermediate frames rendered. This should be used if you want to continuously rotate a rigidbody in each FixedUpdate.

Set Rigidbody.rotation instead, if you want to teleport a rigidbody from one rotation to another, with no intermediate positions being rendered.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Rigidbody rb; Vector3 newPos = new Vector3(10.0f, 0.0f, 3.0f); float speed = 1.0f;

void Start() { rb = GetComponent<Rigidbody>(); }

// fixedDeltaTime provides the same time that FilterUpdate() uses void FixedUpdate() { if (rb.position.x <= 1.0f) { Vector3 direction = (newPos - transform.position).normalized; rb.MovePosition(transform.position + direction * speed * Time.fixedDeltaTime); } } }

Tele-transporta el objeto (en vez de una transición suave) si tiene isKinematic establecido a falso.