Hi, Why does my capsule game object (or box) roll towards a waypoint, it has a ridged body and capsule collider attached with the below script ?
Thanks.
#pragma strict
var waypoint : Transform;
var speed : float = 20;
function Start () {
}
function Update () {
var target : Vector3 = waypoint.position;
var moveDirection : Vector3 = target - transform.position;
var velocity = rigidbody.velocity;
if(moveDirection.magnitude < 1){
velocity = Vector3.zero;
}else{
velocity = moveDirection.normalized * speed;
}
rigidbody.velocity = velocity;
}