How to push a box that slides until it hits another object?

Hi all

I’m still pretty new to this, so I apologise if I am asking something very basic but I’ve had numerous attempts at trying to achieve a certain effect and I haven’t had much luck so far.

As an exercise, I’m trying to build a game that is similar to an old puzzle game back on the NES called Fire ‘N’ Ice. I’m having trouble figuring out a way of achieving similar physics to the original game when the character pushes a block of ice (you can see how this looks here: Fire 'N' Ice - NES Gameplay - YouTube)

I’m not doing this has a Paper 2D project, but as a side scroller. So far I have a basic level constructed, my character and some blocks positioned on the map. I can push the blocks, but I have to maintain my pushing to keep them moving and I cannot get them to slide (and sometimes they will start to tip over… I want them to stay flat on the floor).

A few things I’ve tried (can’t remember all of them, but here’s roughly what I’ve done so far):

• Playing around with settings for the physics material on the block… doesn’t seem to make much difference, there’s still friction there.

• Tried adding force to the block on Event Hit.

• Tried adding a projectile movement component to the block and triggering that on Event Hit

• Tried adding a radial force component to the character and triggering that when the character touches the block.

• Tried using Set Actor Location

It may be that I’ve been doing the right things but not using them in the right way so I could use some advice on the best way of doing this… I’m a little lost at the moment.

Cheers.

Two pointers: (Speculation on my side. I have very little experience with physics)

Try setting the locked axis. This should prevent the tipping over. Set the linear damping to 0 to avoid friction.

So this might not be the -BEST- way to do this (Event Hit was giving me problems for some reason), but you can use Velocity and traces to achieve this.

I have on my object a projectileMovement component, where I constrain to Y axis, so I don’t move forward and back from the camera (because sidescroller).

I am using a collider to detect overlap for the player (event hit was giving me issues).

I am using traces to detect if I am on the ground, and if I am touching an object.

(btw ignore the arrow component. When I was making this to show ya I was doing it in 3D. The arrow just told me the rotation of my object)

When the player “touches” (overlaps) the block, it gets the rotation via Find Look at Rotation node, starting at the player and ending at the block itself, then get it’s forward vector, which I then multiply by a float (this is where you control its speed) and set it’s velocity accordingly until it is no longer touching the ground or until it hits another object.

I feel like there’s definitely a better way to do this, but for now, this may work for you. I’ve tested it and it works for me.

I use a box trace to check for ground.

If you want them to be destroyed if they hit something, that would be the time to do the event hit, and just check to see if the hit object is whatever is a destroyer, and if it is, destroy actor(self).

Yeah I’ve set this now and it’s stopped the block from tipping over I did have it set before, but I had accidentally set it to the wrong axis, heh.

Thanks for such a detailed reply. My Begin Overlap event doesn’t seem to be firing though… I’ll have to keep tinkering around with it when I have some more time. I’ll let you know if/when I can get it working.

Got this working fine with Event Hit… seems odd that I can’t get it working with overlap (must be missing a setting somewhere).

One other thing, I had to remove my constraints on the Z axis as this strangely seems to prevent the box from moving at all. :\ But at least now I’ve got the sort of movement I’m looking for - I can continue tweaking the settings later.

Thanks!