function MovePosition (position : Vector3) : void
Description
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.
private var speed :
Vector3 =
Vector3 (3, 0, 0);
function FixedUpdate () {
rigidbody.MovePosition(rigidbody.position + speed *
Time.deltaTime);
}
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);
}
}
import UnityEngine
import System.Collections
class example(
MonoBehaviour):
private speed as
Vector3 =
Vector3(3, 0, 0)
def
FixedUpdate():
rigidbody.MovePosition((rigidbody.position + (speed *
Time.deltaTime)))