I noticed some inconsistency in the stepSimulation function, please let me know if I am wrong:
In my understanding, following two piece of code should yield the same result (if dt is a multiple of subDt):
Code: Select all
dynamicWorld->stepSimulation(dt,1000,subDt);
Code: Select all
for (int i=0;i<dt/subDt;i++)
dynamicWorld->stepSimulation(subDt,1000,subDt)
I am not sure if this behaviour is intended. For now I perform the interpolation of my kinematic bodies in a loop of following style (pseudo code):
Code: Select all
for each kinematic body:
transformationDifference=oldTransformation.getInverse()*newTransformation // calculate variation during dt
for (int i=0;i<dt/subDt;i++)
{
for each kinematic body:
setRigidBodyPositionAndOrientation(oldTransformation,transformationDifference,(i+1)/(dt/subDt)) // set the interpolated pos/orientation
dynamicWorld->stepSimulation(subDt,1,subDt)
}