Move instantiated object towards player's posistion

Hi

I have an object that is supposed to instantiate a sphere object and then shoot it towards the player's current position, i have an object that is taking the rotation of the player so that it always looking at them, I have the object instantiating but I have no idea what to do when it comes to applying velocity to the rigidbody.

Thanks

You'll need to AddForce to the Rigidbody.

rigidbody.AddForce(transform.forward * 20); // tune '20' to control the velocity

Note that if you add this to Update(), it will accelerate (as the force is applied every frame).

Also, you've said it's taking the rotation of the player - that won't necessarily mean the object is heading towards them, it's just matching the rotation, so it will move parallel.

The object that spawns the Sphere object will need to Transform.LookAt the player position

you can use `Vector3.forward` of your shooter object.

use:

transform.LookAt(Insert Player Position Here)

to look at your player, and:

rigidbody.AddRelativeForce(0, 0, 1); // Or whatever speed you want

to move forward