Spawned prefab to follow target . HOW ??

how can i transform the position of a prefab from point a to point b of a moving target , i trued setting the X,Y and Z to match the targets z,y and z but i got minimal results

var rocket : Transform;

function Update (){

if ( Input.GetKeyDown("x")){

// spawns a rocket from "theSpawnPoint"

var rocketobject = Instantiate (rocket,GameObject.Find("theSpawnPoint").transform.position,Quaternion.identity);

rocketobject .rigidbody.AddForce(transform.forward *8000);

how can i get the is object to follow a gameobject in the game on spawning ?

Use Vector3.Lerp and update the ‘to’ vector3 as this is your target, the from will be the current transform of the rocket, destroy on hit or after x:xx.xx amount of time.

you will want to add a script on the rocket that contains the following line of code in the update.


you will want to set the target on spawning.