Firstly I must say thanks to Norbo for BEPU! It's great..
I have been trying to get InterpolatedStates to work smoothly in my project with v1.1.0 of BEPU, but whatever I try, the result seems to not be smooth at all. In contrast, if I don't use InterpolatedStates and call Space.Update(), everything runs very smoothly but the physics will slow down when the framerate drops.. I'm guessing I'm missing something important, maybe someone can help me out..?
My Space initialisation code is as follows:
Code: Select all
Space = new Space();
Space.BufferedStates.Enabled = true;
Space.ForceUpdater.Gravity = new Vector3(0.0f, -9.8f, 0.0f);
Space.ThreadManager.AddThread();
Space.ThreadManager.AddThread();
Code: Select all
Space.Update(elapsed);
Code: Select all
Position = Collidable.BufferedStates.InterpolatedStates.Position;
Orientation = Collidable.BufferedStates.InterpolatedStates.Orientation;
End result is for example, a ball rolling down a hill, or ragdoll ragdolling down the hill is jumping around a bit, as if the InterpolatedStates aren't correct.
If, however, I don't enable BufferedStates on the Space, call Space.Update() (with no time parameter), then use Collidable.Position and Collidable.Orientation, the result is all very smooth as expected, but won't work too well with a varying elapsed frame time, as expected.
Is there anything obvious here that I've missed?
Thanks!