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.
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.
- 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)
- 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.
- 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?