Weird collision error when using waypoint script...

I am trying to make a script so when the object the script is attached to collides with the target (waypoint end) the object will get destroyed. But when it is about to collide my object gets stopped by some sort of force field :o.

Here is my code:

var waypoint : Transform; var speed: float = 20;

function Update() {
var target : Vector3 = waypoint.position;
var moveDirection : Vector3 = target-transform.position;

var velocity = rigidbody.velocity;

if(moveDirection.magnitude < 1){
    velocity =;

else {
    velocity = moveDirection.normalized * speed;
rigidbody.velocity = velocity;

function OnCollisionEnter(col : Collision) {
if(col.gameObject == waypoint) {


What is wrong? Thanks in advance.

NOTE: The collision error occurs only with the waypoint script.

Try change this:

if(moveDirection.magnitude < 1){

to this:

if(moveDirection.magnitude < 0.001){

Otherwise it'll be stopping 1m away from your object