How to stop an object using tween from going through platform objects?

So i used Tweens to make my character do a dash move but now it goes through walls/platform objects… how do i fix that?

When the dash is inputted, before you start a dash you need to check forward and store the position of the obstacle. Or do it with math.
Ether you shoot an object or you raycast.
Then if stored value < dashdistance
Tween to stored value
If stored value > dashdistance
Tween to dash distance

another option is to use the stop tween + remove tween if in collusion with obstacle

1 Like

FYI I started my game using tweens to do some advanced animations on the platformer objects, and like Slash mentioned it was possible to add extra conditions to limit the tweens or stop the tweens and enforce platform collisions better… but over time I realized that the time I thought I was saving using tweens ended up creating these types of complications and being “not worth it” for me in the end.
I switched to applying forces and combinations of forces. The collisions are enforced much better using forces.
So just my two cents, just wanted to share in case it saves you time.


Forces an tweens should not be used on platformer characters because it messes collisions and states. The character speed can be changed using platformer character actions. This extension uses them and provides dash features: