- Home /
GameObject rolls towards Waypoint
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;
}
Comment
Answer by Major · Jul 28, 2012 at 07:52 AM
it sounds to me like you need to check is kinematic under the rigidbody. otherwise i don't now.
Your answer
Follow this Question
Related Questions
Waypoint Error. 1 Answer
Waypoint system teeling player where to go 1 Answer
How to setup car positioning with lots of routes? 0 Answers
waypoint script - stop at targets 2 Answers
Movement AI 1 Answer