Lock the Z axis when moving a mesh with the mouse

Hello everyone,

I have made a Blueprint to move a mesh to the position of the cursor of the mouse, you will find it below.

This works well when I try to move the mesh but when I click on my mesh, it “flies”. It is going upper in the Z axis.

Someone now how I can lock the Z axis, in order to have my mesh staying at z = 0, please ?

Thank you !

After you set your “mouse location” from the hit result you can set the Z of “mouse location” to the Z of “Original Location”. This should keep your character at the same Z value and avoid him flying up and down.

Is it a new node to add or on one existing node on the screenshot ? I don’t find this option … :confused:

I can’t go into great detail as I’m at work and can’t actually see what I’m talking about. But you should be able to break the vectors to acquire their Z position. You would then set the Z position of Mouse location to the Z position of your Original Location.

I would highly recommend watching this tutorial series if you haven’t already. UE4 Blueprint Tutorials

Thank you Snackmix ! It works with break vector and make vector :slight_smile:

breakmakevector.jpg

No problem! Glad you got it figured out :smiley: