m_localTime(0),
m_synchronizeAllMotionStates(false),
m_applySpeculativeContactRestitution(false),
-m_profileTimings(0)
+m_profileTimings(0),
+m_fixedTimeStep(0),
+m_interpolation(false)
{
if (!m_constraintSolver)
{
btTransform interpolatedTransform;
btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(),
- body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(),m_localTime*body->getHitFraction(),interpolatedTransform);
+ body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(),
+ (m_interpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime*body->getHitFraction(),
+ interpolatedTransform);
body->getMotionState()->setWorldTransform(interpolatedTransform);
}
}
if (maxSubSteps)
{
//fixed timestep with interpolation
+ m_fixedTimeStep = fixedTimeStep;
m_localTime += timeStep;
if (m_localTime >= fixedTimeStep)
{
{
//variable timestep
fixedTimeStep = timeStep;
- m_localTime = timeStep;
+ m_localTime = m_interpolation ? 0 : timeStep;
+ m_fixedTimeStep = 0;
if (btFuzzyZero(timeStep))
{
numSimulationSubSteps = 0;
//for variable timesteps
btScalar m_localTime;
+ btScalar m_fixedTimeStep;
//for variable timesteps
bool m_ownsIslandManager;
///Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (see Bullet/Demos/SerializeDemo)
virtual void serialize(btSerializer* serializer);
+ bool m_interpolation;
};
#endif //BT_DISCRETE_DYNAMICS_WORLD_H
return gdxBulletJNI.btDiscreteDynamicsWorld_getApplySpeculativeContactRestitution(swigCPtr, this);\r
}\r
\r
+ public void setInterpolation(boolean value) {\r
+ gdxBulletJNI.btDiscreteDynamicsWorld_interpolation_set(swigCPtr, this, value);\r
+ }\r
+\r
+ public boolean getInterpolation() {\r
+ return gdxBulletJNI.btDiscreteDynamicsWorld_interpolation_get(swigCPtr, this);\r
+ }\r
+\r
}\r
public final static native boolean btDiscreteDynamicsWorld_getSynchronizeAllMotionStates(long jarg1, btDiscreteDynamicsWorld jarg1_);\r
public final static native void btDiscreteDynamicsWorld_setApplySpeculativeContactRestitution(long jarg1, btDiscreteDynamicsWorld jarg1_, boolean jarg2);\r
public final static native boolean btDiscreteDynamicsWorld_getApplySpeculativeContactRestitution(long jarg1, btDiscreteDynamicsWorld jarg1_);\r
+ public final static native void btDiscreteDynamicsWorld_interpolation_set(long jarg1, btDiscreteDynamicsWorld jarg1_, boolean jarg2);\r
+ public final static native boolean btDiscreteDynamicsWorld_interpolation_get(long jarg1, btDiscreteDynamicsWorld jarg1_);\r
public final static native void delete_btCharacterControllerInterface(long jarg1);\r
public final static native void btCharacterControllerInterface_setWalkDirection(long jarg1, btCharacterControllerInterface jarg1_, Vector3 jarg2);\r
public final static native void btCharacterControllerInterface_setVelocityForTimeInterval(long jarg1, btCharacterControllerInterface jarg1_, Vector3 jarg2, float jarg3);\r
}\r
\r
\r
+SWIGEXPORT void JNICALL Java_com_badlogic_gdx_physics_bullet_gdxBulletJNI_btDiscreteDynamicsWorld_1interpolation_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {\r
+ btDiscreteDynamicsWorld *arg1 = (btDiscreteDynamicsWorld *) 0 ;\r
+ bool arg2 ;\r
+ \r
+ (void)jenv;\r
+ (void)jcls;\r
+ (void)jarg1_;\r
+ arg1 = *(btDiscreteDynamicsWorld **)&jarg1; \r
+ arg2 = jarg2 ? true : false; \r
+ if (arg1) (arg1)->m_interpolation = arg2;\r
+}\r
+\r
+\r
+SWIGEXPORT jboolean JNICALL Java_com_badlogic_gdx_physics_bullet_gdxBulletJNI_btDiscreteDynamicsWorld_1interpolation_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {\r
+ jboolean jresult = 0 ;\r
+ btDiscreteDynamicsWorld *arg1 = (btDiscreteDynamicsWorld *) 0 ;\r
+ bool result;\r
+ \r
+ (void)jenv;\r
+ (void)jcls;\r
+ (void)jarg1_;\r
+ arg1 = *(btDiscreteDynamicsWorld **)&jarg1; \r
+ result = (bool) ((arg1)->m_interpolation);\r
+ jresult = (jboolean)result; \r
+ return jresult;\r
+}\r
+\r
+\r
SWIGEXPORT void JNICALL Java_com_badlogic_gdx_physics_bullet_gdxBulletJNI_delete_1btCharacterControllerInterface(JNIEnv *jenv, jclass jcls, jlong jarg1) {\r
btCharacterControllerInterface *arg1 = (btCharacterControllerInterface *) 0 ;\r
\r