Download

A Limbo-like push/pull crate system?

I’m working on a puzzle platformer game and I’m trying to implement a push-pull system for objects, like the crate push/pull system they have in Limbo.

e60f255876aaaa296bc2def573cf594c47697da9.jpeg

I want to be able to push and pull crates on flat and slightly slanted surfaces ,and I also need to be able to push them off a platform or a cliff.
I’ve tried doing this in a couple of ways and none of them are working for me.
I’ve tried:

  1. Using a Physics Handle component and setting the crate location on Tick, but it doesn’t work on slanted surfaces
    (I still haven’t tried setting the rotation so it matches the terrain, but that doesn’t seem like a right way to solve this problem)
  2. Using a Physics Constraint component and attaching the crate to my character capsule.
    The problem with this approach is that I can’t push it off a cliff. I taught about releasing the “hold” on the crate when it’s rotated past a certain angle, but it doesn’t work so well and it doesn’t feel natural.
    It also works poorly on slanted and curved surfaces, especially when going from slanted to regular ones - it is trying to maintain an angle it had on the moment when I “grabbed” the crate - so I end up pushing it on its corner while it’s bouncing all the time.
  3. I’ve even taught about attaching the box to my hierarchy but I’ve instantly given up on the idea because the crate wouldn’t collide with other world objects (while being pushed). Not the mention that the gravity wouldn’t work and that i would have to set the rotations manually.

Regular pushing while my capsule is colliding with the crate works well, but I need to be able to pull the crates too so I’m looking for a solution that applies to both pushing and pulling!
I’ve seen other posts on this topic but none of the answers had other suggestions than the ones I already tried.
Could someone point point me in the right way or just give me an idea -
How do I implement this system?

Applying physics to the crate doesn’t allow it to be pushed?

I need both pushing and pulling to work in a same way.
A character grabs the crate and then moves forward or backward pushing or pulling the crate(Holding his hands on the crate at all times and keeping the same distance between the character and the crate).
Something like pushing/pulling this trap:

https://www.youtube.com/watch?v=bwHF5wB--YU

In what way do you think I should apply physics to the crate?

If the character is moving backwards, apply force towards the character, and vice versa. Would that work?

I think that wouldn’t work if there was a change in terrain - I would need to apply different amounts of force depending on the angle of the terrain and I need the crate to maintain its distance to the player - but also to be able to fall of a cliff.
If I think about this scenario for a while:
I am walking towards the crate and applying force - i suddenly stop but it keeps on going so I need to stop it’s movement entirely to maintain distance - It might work on a terrain that’s just flat.
If I’m pushing it off a cliff, and if it is standing on the edge and leaning it’s just about to fall so i stop pushing it forward so the crate movement stops - it’s probably not going to fall(I had a scenario similar to this one when I severed the constraints on a physics constraint actor, and the box wouldn’t fall until it got a small impulse to awaken it. I still didn’t know about “sleeping” physics back then). I might do a raycast to detect if the crate is leaning off a cliff and and then just ignore it’s movement but that could backfire.
If i get this to work i still have the trouble of calculating the force needed to push the crate based on terrain angle - if I’m going uphill or downhill, especially on the transitional parts like the beginning of a ramp - all the while maintaining distance to player
And I don’t know how to do this.

I am, however, going to try applying force (or even setting velocity) and I’ll see if I can come up with something for these special cases to achieve the desired results.
So, thank you for the idea.
But I don’t think I am going to be able to write my way out of this so other ideas are still welcome.

Is there really no one that can help me with this problem?

Hey i am trying the achieve like the exact same push and pull systems as you. i have tried similar ways of making it work but none of them work the way i want it to. I realize this post is fairly new so you might not of come across a solution to this problem yet but if you do please tell me how it can be done!!!

I would be interested to know if you found a solution for this one

I would also be interested…

We tried constraints between character and one box and the results are not ok

Have you found a solution? I’m just trying to get the same result and struggling with the same issue.