move object along x and y axis without affecting its forward z axis

Hi Everyone,

How can i get an object to follow the mouse pointer when it is pressed however to move to the point where the mouse is pressed but move in tandem with the mouse pointer, yet still have the object that is following the mouse pointer on the x and y axis move forward on the z axis at any given rate.

Thanks

Good day.

This is a very basic question, you should go learn about vectors and scripting…

transform.position = new Vector3 (transform.position.x, transform.position.y, transform.position.z)

Just replace some of the compontnts you want to change for the new value

Bye!