Making a ball squidge...
imjustmike
Member Posts: 450
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?
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
http://www.deepblueapps.com/soft-body-physics-template/
Darren.
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