btKinematicCharacterController with a btMotionstate - how?

Post Reply
Posts: 7
Joined: Sun Jan 30, 2011 4:15 pm

btKinematicCharacterController with a btMotionstate - how?

Post by hymerman » Sun Jun 10, 2012 11:21 am

I've seen this question asked twice before, sort of:

Using MotionState with CharacterController
btKinematicCharacterController and interpolation

The first of these seems to have only been asking because they thought a motion state was the only way to get a world transform from an object, and the second is basically what I'm after but has gone unanswered.

The problem is, when running with a fixed timestep, but rendering at anything other than this fixed frequency, character controllers (and I presume everything that isn't a rigid body) don't have their position interpolated because they don't have a btMotionState, and so suffer from little jumps in position.

It looks like the use of btMotionState is quite embedded in Bullet, being controlled from inside btDiscreteDynamicsWorld, and only btRigidBody owns them. Presumably the best way to support btMotionStates for other types of objects would be to subclass those objects, adding the extra interpolation stuff from btRigidBody, and to subclass btDiscreteDynamicsWorld and override saveKinematicState and synchronizeMotionStates to try to upcast those types and operate on their motion states too.

Does that sound sensible? Is there a better way of doing this? And is something like this planned for future Bullet versions? I imagine interpolation for non-rigid-bodies is something most serious developers are going to expect!

Post Reply