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

**URL:** <https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445>\
**Category:** Programming & Scripting\
**Tags:** sprite, unreal-engine, question\
**Created:** [July 7, 2023, 3:46pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445 "2023-07-07T15:46:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [July 7, 2023, 3:46pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/1 "2023-07-07T15:46:08Z")

</div>

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…?

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/5/7f5d6f38968c2eaf5980b693489e9c0ac7610b21.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/5/7f5d6f38968c2eaf5980b693489e9c0ac7610b21.mp4)

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’.

 ![BP_ApplePushTest 07_07_2023 16_01_00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/1/9d18fce4a2e2b131dfa68438d6add6bbaf2423be.png)

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.

 ![BP_ApplePushTest 07_07_2023 16_00_51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/8/1f801d6094465a66b67804a922217319d6b91db9.jpeg)

I hope I’ve explained this well enough, any help or ideas would be really helpful, thanks! 🙂 ✌

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [July 11, 2023, 10:54am UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/2 "2023-07-11T10:54:45Z")

</div>

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! 😄

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/b/e5bd6664c74b00e18a0b647b631ce940288dbaf5.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/b/e5bd6664c74b00e18a0b647b631ce940288dbaf5.mp4)

Here’s the updated code:

 ![BP_ApplePushTest 11_07_2023 11_53_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/7/2175fd58647c27b5946ccd51c4fadb65aa916b90.png)

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 14, 2023, 11:51am UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/3 "2023-08-14T11:51:23Z")

</div>

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 😩)

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/7/257d84cdb7f7b4fa0e9bb1d8f4175f85d6e9bb4a.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/7/257d84cdb7f7b4fa0e9bb1d8f4175f85d6e9bb4a.mp4)

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

 ![BP_ApplePushTest 14_08_2023 12_37_45](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/6/476cfd529e0981f63ec8202c88439200263a2149.png)

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

 ![BP_ApplePushTest 14_08_2023 12_38_01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/f/0bf70124340cd20f4f58d35b87cdc8b732f488bf.jpeg)

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

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/f/8bfa1e4f754c6f37c10a943dd2dd9e6cb419efca.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/f/8bfa1e4f754c6f37c10a943dd2dd9e6cb419efca.mp4)

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! ✌

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 14, 2023, 1:07pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/4 "2023-08-14T13:07:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 14, 2023, 2:03pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/5 "2023-08-14T14:03:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 14, 2023, 2:07pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/6 "2023-08-14T14:07:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 14, 2023, 2:45pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/7 "2023-08-14T14:45:17Z")

</div>

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

 ![BP_ApplePushTest 14_08_2023 15_44_23](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/3/4233d3fc999e8669e140f5a7915eb8b16d49ccab.png)

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 14, 2023, 2:54pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/8 "2023-08-14T14:54:39Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/1/ed1d59546c4d6bb4d13a50ca032937926af29ba9.png)

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 14, 2023, 5:06pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/9 "2023-08-14T17:06:42Z")

</div>

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! 🎉

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/5/6a5783a965cd5e86b34e2ddae0139eb4bb14e1c9.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/5/6a5783a965cd5e86b34e2ddae0139eb4bb14e1c9.mp4)

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! ✌ ❤

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/0/4901dd0778b23df7645d7c9c8aa1b89abdb8592c.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/0/4901dd0778b23df7645d7c9c8aa1b89abdb8592c.mp4)

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 14, 2023, 5:08pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/10 "2023-08-14T17:08:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 14, 2023, 5:25pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/11 "2023-08-14T17:25:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 15, 2023, 10:50am UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/12 "2023-08-15T10:50:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 15, 2023, 1:35pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/13 "2023-08-15T13:35:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 15, 2023, 2:57pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/14 "2023-08-15T14:57:07Z")

</div>

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! ❤✌

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 16, 2023, 7:24pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/15 "2023-08-16T19:24:09Z")

</div>

Something like that:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/6/6d6024e038a9bedbbf97d7062b8f49dee8f81af4.png)

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 18, 2023, 3:35pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/16 "2023-08-18T15:35:35Z")

</div>

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?? 😭 😩)

 ![BP_ApplePushTest 18_08_2023 16_28_52](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/3/953960b3d75dff2cd15585d6a0840de47e9c3d2b.png)

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?

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/8/2c8fdda08ce673a2700941ea9384d25fb88b8c0d.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/8/2c8fdda08ce673a2700941ea9384d25fb88b8c0d.mp4)

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

 ![BP_ApplePushTest 18_08_2023 16_28_16](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/a/6ca205d6f6fb5cedf4d02156f1047ba91195818f.png)  

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/2/f72bab539d21b62a1d18edef6947ef3be44f44b9.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/2/f72bab539d21b62a1d18edef6947ef3be44f44b9.mp4)

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:

 ![BP_ApplePushTest 18_08_2023 16_29_05](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/1/21140b1d46ec60960e50cd52af0e6a7392ab06e6.png)  
 ![BP_ApplePushTest 18_08_2023 16_29_10](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/6/f76d93c5cffcf726dc1a5d87dc3659b6b6f0a0fc.png)

If you don’t know either that’s fine! Thanks so much for all your help! 💞 ✌

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 18, 2023, 3:47pm UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/17 "2023-08-18T15:47:57Z")

</div>

Do you have more than 1 apple on level?

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 19, 2023, 10:53am UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/18 "2023-08-19T10:53:11Z")

</div>

Just one currently!

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 19, 2023, 10:56am UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/19 "2023-08-19T10:56:46Z")

</div>

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

> [@Shunitzo](#):
>
> Something like that:
> 
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/6/6d6024e038a9bedbbf97d7062b8f49dee8f81af4.png)

---

<div class="post-metadata">

**Author:** ![WillMead13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/willmead13/32/1075245_2.png) [@WillMead13](https://forums.unrealengine.com/u/WillMead13)\
**Post date:** [August 19, 2023, 10:59am UTC](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445/20 "2023-08-19T10:59:24Z")

</div>

What’s trace? Is it a different event? ✌

[Next page](https://forums.unrealengine.com/t/using-2d-sprites-to-make-a-push-able-interactable-object-with-physics/1222445.md?page=2)
