LookAt Works! Need help with follow.

I need some help here. I have the object looking at my player with the code below:

var target : Transform;

function Update() {
transform.LookAt(target);

}

Now I just want it to move towards to the target. Can anyone help me. My eyes are bleeding :slight_smile:

var target : Transform; 


function Update() { 
transform.LookAt(target); 
transform.Translate(transform.forward);

}

we’re close and thanks Kiyaku: Here’s the issue:

  1. The object now runs away from the camera. I want it to run towards it. It was fun to watch it though.

use -transform.forward then :slight_smile:

:smile: Ok I did this.

var target : Transform;

function Update() {
transform.LookAt(target);
transform.Translate(transform.forward, target);

}

It works, but all too well. How can I only have it come towards the camera it say I step on a trigger. The trigger has a tag of “MyTrigger”

this should do it for me after mate. Thanks