Moving an object toward another

how can i get an object to follow and move toward an object (eg. First Person Controller), like a zombie normally would? Im trying to make a zombie so this is crucial. lol.

You could use the ITween asset for this. It has a MoveTo method with lots of options for controlling movement, like travel speed, ease in/out and callback method on completion:


I hope this helps.

var player: GameObject;
var distance: Vector3;
var zombie:GameObject;
var speed:float;
var target : Transform;
var rotatespeed = .5;


function LastUpdate () {

   targetRotation = Quaternion.LookRotation (target.position - transform.position);

   str = Mathf.Min (rotationspeed  * Time.deltaTime, 1);

    function Update(){
          distance = Vector3.Distance(player.transfrom.position, zombie.transfrom.position);
    function ZombieAttack(){
           transfrom.position = Vecto3.lerp(zombie.transfrom.position, player.transfrom.position, distance/speed * Time.deltaTime);
           transform.rotation = Quaternion.Lerp (transform.rotation, targetRotation, str);

Ok I hope this solves your problem, I’m sorry I don’t have time to explain what’s happening, please use the script reference or Answers.
Lastly, I typed this on my iPad so there might be an error or two.

Edit: Also you will have to edit this a little(ie: call the zombie attack function)
Last edit: you need to place this on the zombie, or edit it to fit else ware.

Transform target;

void Update(){