Using 2D sprites to make a push-able/ interactable object with physics?

Hello! I am developing a 2.D mobile game and am having an issue with one of the gameplay mechanics. I want to include a round object (apple) that can be pushed and roll smoothly whilst playing the characters push animation.

I am trying to teach myself blueprints through Youtube tutorials, although could not find one for this exact topic. I followed a tutorial to push a block (3D) and then redid it while referencing the Unreal Documentation for 2D PaperSprites. This worked, although it looks rather janky…?

Here’s the code for the 2D object. I did want the physics to always be on, however removing this section of the blueprint made it so the player did not play the pushing animation? It seems it did not count as ‘is pushing’.

Here’s the current physics settings for the apple. Another thing to add is that when I switched the references in the ‘simulate physics’ node to the collider and made the sprite a child of the collider, I got error messages and the apple fell through the floor.

I hope I’ve explained this well enough, any help or ideas would be really helpful, thanks! :slight_smile: :v:

For anyone else stuck with this problem, I thought I should update this question!

After some help on LinkedIn (thanks!) I now have this, it doesn’t roll still although the movement is not janky and jittery which is a huge step up! :smile:

Here’s the updated code:

1 Like

Hello! I have made some progress although am still having a few issues, although it’s a LOT better than what it originally was so I thought I should update this in
case anyone else is having the same issue!

Here’s how the apple rolls now (a lot smoother from the janky juttery first video :weary:)

Here is my updated code! (Although the Event Tick part does not work?)

Adding an extra collision called ‘roll’ and applying the physics to that instead is the main fix I found for this.

However, there are still problems, the character now plays the pushing animation when on top of the apple standing (as the animation plays when ‘Is pushing?’ is true).

If anyone has any idea how to fix this I’d greatly appreciate it! And if you’re stuck with the same problem I hope this update helped you a bit too! :v:

1 Like

Try checking if the Z axis difference between a player and object is in the needed range to push.

How exactly would I do this? I am a bit of a beginner in Unreal? Thanks so much for the response! :v:

Tick:
Player Z - Apple Z → In range (for exampel min=-20, max=20)->“Not” node->Branch->IsPushing

Or you can do it on overlap. If you don’t want to overuse tick.

Is this what you meant? This still has him pushing ontop of the apple, however I’m not sure if I’ve done it right haha

1 Like

Hi! Thanks so much for your help! I copied your blueprints and it mostly works perfectly!
When pushing one apple it stops him from animating when standing ontop! :tada:

Although the physics are a bit strange (they seem rather weightless for some reason?)
and when I add more than one apple the character doesn’t seem to want to push any of them? Thanks for much for taking the time to help, as a beginner I really really appreciate it! :v: :heart:

Just realised the first video wasn’t long enough to show him actually stood on the apple (? :weary:) although it does work (thanks again!) :v:

I recommend you to move Is Pushing collision volume check from apple to character. It will make easier to work with. And also will boost performance a bit, because overlap event is getting checks every frame, more apples - more checks, more checks - more hit on fps.

Or do it using Sphere Trace.

Awesome! Thanks, I’ll try this later, so do I cast to the apple then do the is pushing code? :heart:

I see that you just setting one bool. You can do it on players blueprint.

Here is what you can do:
On Tick do a line/sphere trace from the player location to a direction player is looking. Check if the trace hit result is an apple, if yes - set Is Pushing to true. If not, you get the idea.

This method will eliminate the need for collision volumes.

Hi sorry, I’m a bit confused about what you mean? If not it’s totally fine but would you be able to show me through the blueprints again? If you can’t don’t worry about it! :heart::v:

Something like that:

Hey dude, sorry for going MIA for a while, I was converting everything in my project to work with PaperZD rather than individual flipbook each time! Although, I am having a problem with the apple recognising the ‘Is Pushing’ Booloean now and stopping pushing on top of the apple? (I don’t know what I’ve done wrong because it was working last time?? :sob: :weary:)

When I use this code that we set up to detect the player being on top of the apple, none of the pushing animations play?

Although if disconnect that part the animations play however he, obviously, animates on top of the apple?


I’m not sure if setting up the PaperZD has had an effect on this? These are the two transitions I set up between the animations:


If you don’t know either that’s fine! Thanks so much for all your help! :revolving_hearts: :v:

Do you have more than 1 apple on level?

Just one currently!

I think you should move to trace, because if you gonna use tick on every apple it will create problems.

What’s trace? Is it a different event? :v: