processed a lot of feedback: added 'realtime' simulation with fixed substeps (and clamping maximum number of substeps), this means that when stepSimulation is called with smaller timesteps then 'fixed substep' the motionstate is interpolated.

renamed m_ccdSweptSphereRadius,
enabled wireframe debugDrawObject (using debugDrawer)
This commit is contained in:
ejcoumans
2006-10-18 03:28:42 +00:00
parent 1fe414d98a
commit 3a6942fb91
32 changed files with 406 additions and 185 deletions

View File

@@ -0,0 +1,32 @@
#ifndef DEFAULT_MOTION_STATE_H
#define DEFAULT_MOTION_STATE_H
///btDefaultMotionState provides a common implementation to synchronize world transforms with offsets
struct btDefaultMotionState : public btMotionState
{
btTransform m_graphicsWorldTrans;
btTransform m_centerOfMassOffset;
btTransform m_startWorldTrans;
btDefaultMotionState(const btTransform& startTrans,const btTransform& centerOfMassOffset = btTransform::getIdentity())
: m_graphicsWorldTrans(startTrans),
m_centerOfMassOffset(centerOfMassOffset),
m_startWorldTrans(startTrans)
{
}
///synchronizes world transform from user to physics
virtual void getWorldTransform(btTransform& centerOfMassWorldTrans )
{
centerOfMassWorldTrans = m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ;
}
///synchronizes world transform from physics to user
virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans)
{
m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ;
}
};
#endif //DEFAULT_MOTION_STATE_H

View File

@@ -38,13 +38,13 @@ class btIDebugDraw
enum DebugDrawModes
{
DBG_NoDebug=0,
DBG_DrawAabb=1,
DBG_DrawText=2,
DBG_DrawWireframe = 1,
DBG_DrawAabb=2,
DBG_DrawFeaturesText=4,
DBG_DrawContactPoints=8,
DBG_NoDeactivation=16,
DBG_NoHelpText = 32,
DBG_DrawWireframe = 64,
DBG_DrawText=64,
DBG_ProfileTimings = 128,
DBG_EnableSatComparison = 256,
DBG_DisableBulletLCP = 512,

View File

@@ -16,9 +16,7 @@ subject to the following restrictions:
#ifndef BT_MOTIONSTATE_H
#define BT_MOTIONSTATE_H
#include "LinearMath/btVector3.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btTransform.h"
///btMotionState allows the dynamics world to synchronize the updated world transforms with graphics
///For optimizations, potentially only moving objects get synchronized (using setWorldPosition/setWorldOrientation)
@@ -31,14 +29,9 @@ class btMotionState
}
virtual void getWorldPosition(btVector3& worldPos )=0;
virtual void getWorldScaling(btVector3& scaling)=0;
virtual void getWorldOrientation(btQuaternion& orn)=0;
virtual void setWorldPosition(const btVector3& worldPos)=0;
virtual void setWorldOrientation(const btQuaternion& orn)=0;
virtual void getWorldTransform(btTransform& worldTrans )=0;
virtual void calculateWorldTransformations()=0;
virtual void setWorldTransform(const btTransform& worldTrans)=0;
};