Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I use the bullet physics engine through Panda3d.

My scene is still very simple, think 'Wolfenstein3d': tile-based, walls are solid cubes.

I expect walls to block the player, and I expect the player to slide along the walls in case of non-normal incidence.

What I get is what I expect, with one difference: there is some jitter. If I try to force myself into the wall, then I see the frames blinking quickly between two positions. These differ by about 0.04 units of distance, which corresponds to 4 cm in my game.

I noticed a 4 cm elsewhere: the bottom of my player capsule is 4 cm below ground, when at rest.

Does that mean that there is somewhere in the Bullet engine a default 0.04-units-long tolerance to differentiate contact from collision? If so, what should I do ? Should I change the scale of my game so that these 0.04 units correspond to 0.4 cm, making the jitter ten times smaller? Or can I ask bullet to change its tolerance to a smaller value?


This is the jitter I get: 6.155 - 6.118 = 0.036

LPoint3f(0, 6.11694, 0.835)
LPoint3f(0, 6.15499, 0.835)
LPoint3f(0, 6.11802, 0.835)
LPoint3f(0, 6.15545, 0.835)
LPoint3f(0, 6.11817, 0.835)
LPoint3f(0, 6.15726, 0.835)
LPoint3f(0, 6.11876, 0.835)
LPoint3f(0, 6.15911, 0.835)
LPoint3f(0, 6.11937, 0.835)

I found a setMargin method. I set it to 5 mm both on the BoxShape for the walls and on the Capsule shape for the player. It still jitters by about 35 mm as illustrated by this log (11.117 - 11.082 = 0.035):

LPoint3f(0, 11.0821, 0.905)
LPoint3f(0, 11.1169, 0.905)
LPoint3f(0, 11.082, 0.905)
LPoint3f(0, 11.117, 0.905)
LPoint3f(0, 11.082, 0.905)
LPoint3f(0, 11.117, 0.905)
LPoint3f(0, 11.0821, 0.905)
LPoint3f(0, 11.1175, 0.905)
LPoint3f(0, 11.0822, 0.905)
LPoint3f(0, 11.1178, 0.905)
LPoint3f(0, 11.0823, 0.905)
LPoint3f(0, 11.1183, 0.905)

The margin on the capsule did change my penetration with the floor though, I'm a bit higher (0.905 instead of 0.835). However, it did not change anything when colliding with the walls.

How can I make the collisions against the walls less jittery?

Edit, the day after:

After more investigation, it appears that dynamic objects behave well. My problem comes from the btKinematicCharacterController that I use for moving my character; that stuff is totally bugged, according to the whole Internet :/.

share|improve this question

3 Answers 3

Sounds like your engine constantly tries to update the parameters of that object. The object should freeze in position once it reaches a state that Bullet has decided upon to be "stable". Otherwise, numerical errors won't ever result in accurate collision handling, therefore that jittery motion (forces build up eventually, objects are penetrating again, oscillations result). Some ideas are mentioned here. I would start investigating the "sleep issue". Perhaps someone who has hands on experience with this engine could provide a way to set the sleeping threshold efficiently in your case.

share|improve this answer
After more investigation, it appears that dynamic objects behave well. My problem comes from the btKinematicCharacterController that I use for moving my character ; that stuff is totally bugged, according to the whole Internet. –  Niriel May 1 '12 at 10:01
Sorry to hear about that, I am not a Bullet expert and haven't had the chance to take a look at that mechanism. One observation is that your moving character couldn't enter "sleep mode" because it constantly needs to get force updates that would make it slip out of "freeze/sleep" mode. –  teodron May 1 '12 at 15:37
I'll definitely keep in mind this notion of 'sleep mode' in the future. I should also check my normals, maybe I have double-sided polygons? –  Niriel May 2 '12 at 11:38

This sounds like numerical instability due to floating point inaccuracy. Are you using the scale factors for your scene/objects as per the vendor's recommendation?


General checklist for physics engine jitter

  • Make sure you are using the correct scale factors
  • Make sure that the quantities are reasonable (e.g. 10m, 80kg, ...)
  • Enable sleeping if this is an object without any internal forces (i.e. it has no controller/force generator)
  • Explore all settings related to ray casting. Plausible cause to your problem
  • Relax the penetration depth tolerance to allow for some penetration. Likely cause to your problem

† This can potentially allow cameras to "see through" walls, and can be solved by putting a thin, invisible object in front of the wall or expanding the AABB to act as a buffer.

share|improve this answer
If you're talking about the scale of my 3D models (and therefore collision boxes/shapes), then they're all 1. –  Niriel Aug 16 '12 at 7:59
And roughly what kind of sizes and distances are in play? –  Martin Källman Aug 16 '12 at 8:24
1 unit corresponds to 1 meter. –  Niriel Aug 16 '12 at 8:25

One thing you might want to look into is a CCD option. In some physics engines you can an option to enable "Continuous Collision Detection."

Its much more resource intensive, but rather than solve the collision as a Yes/No at each time step it works to find the actual point of collision and stop you there.

I'm not familiar with the bullet engine, but that might give you something to look for. Interestingly enough its most often used for things like bullets to prevent wall penetration.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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