1
\$\begingroup\$

In my 2D platformer game my player character is modeled using a Box2D dynamic body. One thing I thought feels off though is that even though the restitution of the fixture applied is zero, the player will bounce off static geometry when falling at an angle, kind of like a plastic box would perhaps, but certainly not like a body would.

There isn't really much that Box2D allows me to tweak though except for density and restitution? I noticed that playing with the density has basically no effect on how the player moves which I thought was odd too.

Are there any realistic value ranges you would recommend? It's all a bit trial and error right now for me.

\$\endgroup\$
1
\$\begingroup\$

Correct me if I'm wrong, but I believe the density of fixtures will affect the mass of the body.

Anyway, the only settings that affect the "bounciness" is restitution. If changing the restitution of the box doesn't fix it, have you tried changing the restitution of the ground (or whatever the box shouldn't be bouncing off of)?

If that doesn't work, as far as I'm aware the only other solution would be to listen for collision events and add forces to counteract the bouncing. I don't recommend this, as it can be buggy, but it's possible to get decent results depending on your needs.

\$\endgroup\$
  • \$\begingroup\$ I'm still experimenting with your suggestions, I'll report back in a while \$\endgroup\$ – Matthias Dec 15 '14 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.