Download

Movable Crate Sokoban Style

Hello, I am trying to create a movable crate that the player can push in a single direction when standing near it for a sokoban top down game. i created a blueprint with a mesh and a box component, however im having problems laying out the mechanic. If i turn on simulate physics the object start bouncing all over the place.
how can i limit the movement of the box to be ONLY in the opposite direction of where the player is located and only one unit in the game grid?.

(something like this)

Thanks

Hi… im trying to do something similar, Ive made a crate BP component. which i can move a certain amount of units with every push in the correct direction that the pawn is facing etc…
But im struggling to figure out… how i can move more than one box if they end up in a row… somehow i need the crate to know if there is a another movable box like itself next to it in the path it needs to take, and tell the other crates to move also… ive tried multi line trace, but the distance for it to trace can be any length, depending on how many boxes end up in a row and the trace don’t take into account gaps between cubes. so that didn’t work for me… does anyone have any suggestions.

Do. you need me to share how i got the crate moving etc…

Tremor: Do you have the game grid system set up already? Can you post what blueprinting you have so far? Can you normalize the object movement vectors in such a way that all relevant components are either 1, 0 or -1 depending on the character’s vector at the time of collision?

Soul: Can you create a custom collision group for the boxes and have a detect collision of type: (custom collision group of boxes)?

None of this may help but I like trying to :smiley:

Yes. i already use a custom object channel and response.
Explained earlier a multi line trace is not good enough,
Because of 2 reason… one it needs a set distance to trace… pointless because i could have any number of boxes in a row.
And 2nd it does not take into account gaps between the crate within that set trace distance…
Also the crates im using within the scene are a instance of a 1 parent.

so im not understanding how this helps me.