Moving a gameObject towards another one but keeping the old height

Hello everyone!

as the title suggests, I want to move gameObject A to the position of gameObject B but keep the height of A.
this is not supposed to happen constantly but only when I call a certain method and A is not supposed to stop somewhere between start and finish but only when it reaches B (I’m not sure whether the update method is needed for this).

also later on I might want to add something to modify the speed at which A moves to make it look like a curve or parabel (if you’d draw the function). I think it might be of some importance to say this here as I have the feeling that it might be hard to implement later if this movement method does not provide the right “base” to work with.

I’ve been searching for some solutions but I couldnt find anything that would fit my specific problem.

I am using C# btw.

thanks in advance for any helping replies.
regards

Create a new Vector3 which uses the x and z of object B, and the y of object A, and use that as the destination.

–Eric

thanks a lot, after some testing I managed to get it working :slight_smile: