rot | Rigidbody の角度 |
Rigidbody オブジェクトを指定する角度へ回転します
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); } } }
isKinematic
を false に設定すると、スムーズな推移というよりはむしろオブジェクトはテレポートされます。