I'm developing a simple game much like a brick breaker one.
Now on colliding with bricks, player should rebound, it works fine. But on collision with coins, player shouldn't rebound, coins should disappear.
For this I've tried negative restitution for coins & altered b2MixRestitution like this:
/// Restitution mixing law. Feel free to customize this.
inline float32 b2MixRestitution(float32 restitution1, float32 restitution2)
{
//return restitution1 > restitution2 ? restitution1 : restitution2;
float mixRest = 0.0f;
if(restitution1 > 0.0f && restitution2 > 0.0f)
mixRest = (restitution1>restitution2)?restitution1:restitution2;
else
mixRest = (restitution1<restitution2)?restitution1:restitution2;
return mixRest;
}
But still player rebounds naturally.
For coins, restitution is -1.00f. For player, restitution is 0.50f.
Is this even possible to have negative restitution for a body in Box2d?
I just want to know if this is possible for two bodies like coins(static) & player(dynamic) that are meant to collide, dynamic one doesn't rebound after a collision.
Can I do this?