Making a ball squidge...

So a lot of games have balls that bounce off walls, but I haven't seen many from gamesaladers that add an effect to the ball. So they always look a little fake. I'm trying to create an effect that makes the ball look like it gets squashed a little bit.

Creating the effect is pretty easy, reducing the width, then increasing it again when it hits a wall, or the same with height.

What I'm struggling with is how to kick in the rules - how to decide when to squish the ball width or height. It needs to shrink the width when it hits a wall left or right, and height when it collides up or down.

I've tried playing around with motion linear velocity ranges - if the linear y is really low, or really high then the ball is probably dropping or going up, so shrink the height when it collides, and the same thing for x velocity and width.

BUT, it's imprecise, sometimes the ball is moving fast in a diagonal manner and the rules get confused.

Short of constraining extra actors to the ball to detect collision and basing the rules on those actors, I can't think of another way to do this. And that seems like a rather complex and bad way to do something which should be relatively simple for a game engine...

Does anyone have any thoughts?

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited February 2014
    I did a soft body physics demo a while back for DBA,

    http://www.deepblueapps.com/soft-body-physics-template/



    Darren.
  • AdamgoproAdamgopro Member Posts: 310
    only thing i would do here is make another image of the ball but a squished version and have it change to that image on certain actors... so for left wall when hit change image to left squish... but obviously this might not look right depending on your project speed look of it.
  • imjustmikeimjustmike Member Posts: 450
    Thanks Darren, I'll check it out.

    Adam - that's how I would do it (I prefer to use reducing the width rather than animations though) but the issue is knowing when to trigger the rule. For example - if I have a box in the middle of the scene, the ball could hit four different sides, and if there was only rule then the wrong animation would play half the time
Sign In or Register to comment.