How do i push a box across the ground in the direction that the player is looking at?

I’m trying to push a box in the direction my player is facing.

I want the player to be able to enter a box collision a widget to come up to click E key (this part I have) and for the box to move in a precise amount across direction the player is looking at. Then delay so that then the player if want can do it again.

How would I be able to do this?

Maybe something like this?

When player presses push button (teh long blue noodle is coming from an overlapped box actor):

Call function or interface on target:

I can’t get it to work consistently though. The vector snap to grid math node keeps randomly failing to work for me, May be bugged?

1 Like

On second thought. instead of using vector grid snap, you could isolate the x/y direction so it only goes in straight lines:

That GetNSEW function does this to give a normalized cardinal direction:

Finally, I changed the box to use tick for the vinterp:

Can tweak he multiply node in first pic to change how far the box moves.

And if lots of things need to be locked to xor y movement, could toss that GetNSEW function into a library

1 Like

Hi, i too checked and the solution given by @illspiritx is working. I did try this in tick but you can convert as per your requirement

Thank you very much your code was what I needed, I changed something here is the final code is anyone needs it.

And this is the function