Rigidbody.MovePosition 移动位置

function MovePosition (position : Vector3) : void


Moves the rigidbody to position.


For kinematic rigidbodies it applies friction based on the motion of the rigidbody. This lets you simulate moving 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.


using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	private Vector3 speed = new Vector3(3, 0, 0);
	void FixedUpdate() {
		rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime);
private var speed : Vector3 = Vector3 (3, 0, 0);
function FixedUpdate () {
	rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime);
Page last updated: 2011-2-10