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.
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 )
Here is my updated code! (Although the Event Tick part does not work?)
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!
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!
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!
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.
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!
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?? )