Download

Top down 3d game - How can I push an object on touch (100 units at a time "grid" on X,Y)

So I have my character as a paper flipbook sprite in a 3d world that doesn’t rotate per se, it just swaps between different flipbook’s and repositions itself on the x/y/z axis. This was fine in early implementation, but now that I am adding more mechanics to the world it is causing headaches trying to figure out how to push an object away from the characters direction. With no rotational data to go off I am stumped.

I may well be going about this the completely wrong way so would love to hear any better methods of constructing this!

To clarify - I am trying to integrate a pushable pillar that moves in the direction it is pushed along (on X,Y) until it has collision with another object/wall (not important for now though, just the movement working correctly would be a great start!). Using physics is too “free” for this particular object, it needs to be a linear movement conforming to a 100 unit grid.

Here is the character (Paper2D) event viewer tracing collisions and calling the movement/sprite change function
63865b8f72257f93b67035da5d44f082ebc6be22.jpeg

Here is the movement/sprite change function referenced within the event viewer of the character
aedb115bb4d84269f20104a519643200b75f24c7.jpeg

This is the object I am trying to move (bare bones with everything unnecessary stripped out). It currently moves positively up the X axis when pushed from every direction because nothing is telling it to do otherwise at the moment.
It’s clunky and needs smoothing but it’s correctly picking up the collision trace at least i suppose.
4e93b0032f641926b8b04b5097ba6e80b1d24e3a.jpeg

Any and all help would be appreciated. Scratching my head on this one but go easy, I am still learning the ropes :smiley:

You can use the getDirectionVector node to identify the vector you need to push the box in (just remember to isolate the X/Y axes) and go from there.

Thanks for the response 6ixpool, I tried using this but I couldn’t get it setup and working correctly, but I have got it working from a cast of my previous variable for use as an index and a few other tweaks. Silly me :slight_smile: