57 if (((colObj0) && (!(colObj0)->isStaticOrKinematicObject())) &&
58 ((colObj1) && (!(colObj1)->isStaticOrKinematicObject())))
68 for (i = 0; i < numConstraints; i++)
76 if (((colObj0) && (!(colObj0)->isStaticOrKinematicObject())) &&
77 ((colObj1) && (!(colObj1)->isStaticOrKinematicObject())))
96 if (((cur) && (!(cur)->isStaticOrKinematicObject())) &&
97 ((prev) && (!(prev)->isStaticOrKinematicObject())))
116 if (tagA >= 0 && tagB >= 0)
127 BT_PROFILE(
"btMultiBodyDynamicsWorld::updateActivationState");
186 m_multiBodyConstraintSolver(constraintSolver)
246 bool isSleeping =
false;
271 bool isConstraintPass =
true;
317#ifndef BT_USE_VIRTUAL_CLEARFORCES_AND_GRAVITY
324 bool isSleeping =
false;
360 bool isSleeping =
false;
378 bool doNotUpdatePos =
false;
379 bool isConstraintPass =
false;
394 scratch_r2.
resize(2 * numPosVars + 8 * numDofs);
417 btAssert((pMem - (2 * numPosVars + 8 * numDofs)) == &scratch_r2[0]);
429 for (
int link = 0; link < bod->
getNumLinks(); ++link)
431 for (
int dof = 0; dof < bod->
getLink(link).m_posVarCount; ++dof)
435 for (
int dof = 0; dof < numDofs; ++dof)
446 scratch_qx[dof] = scratch_q0[dof];
448 } pResetQx = {bod, scratch_qx, scratch_q0};
454 for (
int i = 0; i <
size; ++i)
455 pVal[i] = pCurVal[i] + dt * pDer[i];
466 for (
int i = 0; i < pBody->
getNumDofs() + 6; ++i)
469 } pCopyToVelocityVector;
475 for (
int i = 0; i <
size; ++i)
476 pDst[i] = pSrc[start + i];
482#define output &m_scratch_r[bod->getNumDofs()]
485 isConstraintPass,
getSolverInfo().m_jointFeedbackInWorldSpace,
487 pCopy(
output, scratch_qdd0, 0, numDofs);
492 pEulerIntegrate(
btScalar(.5) * h, scratch_qdd0, scratch_qd0, scratch_qd1, numDofs);
495 pCopyToVelocityVector(bod, scratch_qd1);
497 isConstraintPass,
getSolverInfo().m_jointFeedbackInWorldSpace,
499 pCopy(
output, scratch_qdd1, 0, numDofs);
504 pEulerIntegrate(
btScalar(.5) * h, scratch_qdd1, scratch_qd0, scratch_qd2, numDofs);
507 pCopyToVelocityVector(bod, scratch_qd2);
509 isConstraintPass,
getSolverInfo().m_jointFeedbackInWorldSpace,
511 pCopy(
output, scratch_qdd2, 0, numDofs);
516 pEulerIntegrate(h, scratch_qdd2, scratch_qd0, scratch_qd3, numDofs);
519 pCopyToVelocityVector(bod, scratch_qd3);
521 isConstraintPass,
getSolverInfo().m_jointFeedbackInWorldSpace,
523 pCopy(
output, scratch_qdd3, 0, numDofs);
532 for (
int i = 0; i < numDofs; ++i)
534 delta_q[i] = h /
btScalar(6.) * (scratch_qd0[i] + 2 * scratch_qd1[i] + 2 * scratch_qd2[i] + scratch_qd3[i]);
535 delta_qd[i] = h /
btScalar(6.) * (scratch_qdd0[i] + 2 * scratch_qdd1[i] + 2 * scratch_qdd2[i] + scratch_qdd3[i]);
540 pCopyToVelocityVector(bod, scratch_qd0);
548 for (
int i = 0; i < numDofs; ++i)
549 pRealBuf[i] = delta_q[i];
557 for (
int link = 0; link < bod->
getNumLinks(); ++link)
566#ifndef BT_USE_VIRTUAL_CLEARFORCES_AND_GRAVITY
589 bool isSleeping =
false;
638 bool isSleeping =
false;
681 BT_PROFILE(
"btMultiBodyDynamicsWorld debugDrawWorld");
685 bool drawConstraints =
false;
691 drawConstraints =
true;
758#ifdef BT_USE_VIRTUAL_CLEARFORCES_AND_GRAVITY
764 bool isSleeping =
false;
805 bool isSleeping =
false;
829#ifdef BT_USE_VIRTUAL_CLEARFORCES_AND_GRAVITY
#define DISABLE_DEACTIVATION
#define FIXED_BASE_MULTI_BODY
#define WANTS_DEACTIVATION
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
btVector3 quatRotate(const btQuaternion &rotation, const btVector3 &v)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define BT_MULTIBODY_CODE
#define BT_MB_LINKCOLLIDER_CODE
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
void remove(const T &key)
void quickSort(const L &CompareFunc)
void push_back(const T &_Val)
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size,...
btCollisionObject can be used to manage collision detection objects.
bool isStaticOrKinematicObject() const
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
int getInternalType() const
reserved for Bullet internal usage
void setActivationState(int newState) const
virtual int calculateSerializeBufferSize() const
void setDeactivationTime(btScalar time)
int getActivationState() const
btDispatcher * getDispatcher()
virtual btIDebugDraw * getDebugDrawer()
btAlignedObjectArray< btCollisionObject * > m_collisionObjects
int getNumCollisionObjects() const
btIDebugDraw * m_debugDrawer
void serializeContactManifolds(btSerializer *serializer)
void serializeCollisionObjects(btSerializer *serializer)
virtual btConstraintSolverType getSolverType() const =0
virtual void allSolved(const btContactSolverInfo &, class btIDebugDraw *)
virtual void prepareSolve(int, int)
btDiscreteDynamicsWorld provides discrete rigid body simulation those classes replace the obsolete Cc...
btAlignedObjectArray< btPersistentManifold * > m_predictiveManifolds
virtual void integrateTransforms(btScalar timeStep)
void serializeRigidBodies(btSerializer *serializer)
void serializeDynamicsWorldInfo(btSerializer *serializer)
btAlignedObjectArray< btTypedConstraint * > m_sortedConstraints
virtual void setConstraintSolver(btConstraintSolver *solver)
virtual void saveKinematicState(btScalar timeStep)
virtual void applyGravity()
apply gravity, call this once per timestep
btSimulationIslandManager * m_islandManager
btAlignedObjectArray< btTypedConstraint * > m_constraints
virtual int getNumConstraints() const
btSimulationIslandManager * getSimulationIslandManager()
virtual void updateActivationState(btScalar timeStep)
btConstraintSolver * m_constraintSolver
virtual void debugDrawWorld()
btCollisionWorld * getCollisionWorld()
virtual void clearForces()
the forces on each rigidbody is accumulating together with gravity. clear this after each timestep.
virtual void predictUnconstraintMotion(btScalar timeStep)
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
btContactSolverInfo & getSolverInfo()
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
virtual void drawTransform(const btTransform &transform, btScalar orthoLen)
virtual int getDebugMode() const =0
@ DBG_DrawConstraintLimits
virtual int getIslandIdA() const =0
virtual void debugDraw(class btIDebugDraw *drawer)=0
virtual int getIslandIdB() const =0
btAlignedObjectArray< btMultiBodyConstraint * > m_multiBodyConstraints
virtual void clearForces()
the forces on each rigidbody is accumulating together with gravity. clear this after each timestep.
virtual void solveInternalConstraints(btContactSolverInfo &solverInfo)
virtual void updateActivationState(btScalar timeStep)
btAlignedObjectArray< btQuaternion > m_scratch_world_to_local
btAlignedObjectArray< btQuaternion > m_scratch_world_to_local1
btAlignedObjectArray< btMatrix3x3 > m_scratch_m
MultiBodyInplaceSolverIslandCallback * m_solverMultiBodyIslandCallback
virtual void serialize(btSerializer *serializer)
Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (see B...
virtual ~btMultiBodyDynamicsWorld()
btAlignedObjectArray< btVector3 > m_scratch_local_origin1
virtual void serializeMultiBodies(btSerializer *serializer)
virtual void addMultiBodyConstraint(btMultiBodyConstraint *constraint)
btAlignedObjectArray< btVector3 > m_scratch_v
virtual void predictUnconstraintMotion(btScalar timeStep)
virtual void calculateSimulationIslands()
virtual void removeMultiBodyConstraint(btMultiBodyConstraint *constraint)
void predictMultiBodyTransforms(btScalar timeStep)
virtual void integrateTransforms(btScalar timeStep)
btMultiBodyConstraintSolver * m_multiBodyConstraintSolver
btAlignedObjectArray< btMultiBody * > m_multiBodies
virtual void getAnalyticsData(btAlignedObjectArray< struct btSolverAnalyticsData > &m_islandAnalyticsData) const
virtual void solveConstraints(btContactSolverInfo &solverInfo)
void integrateMultiBodyTransforms(btScalar timeStep)
virtual void debugDrawMultiBodyConstraint(btMultiBodyConstraint *constraint)
virtual void solveExternalForces(btContactSolverInfo &solverInfo)
virtual void setConstraintSolver(btConstraintSolver *solver)
btAlignedObjectArray< btVector3 > m_scratch_local_origin
virtual void clearMultiBodyForces()
btAlignedObjectArray< btScalar > m_scratch_r
virtual void removeMultiBody(btMultiBody *body)
btAlignedObjectArray< btMultiBodyConstraint * > m_sortedMultiBodyConstraints
virtual void addMultiBody(btMultiBody *body, int group=btBroadphaseProxy::DefaultFilter, int mask=btBroadphaseProxy::AllFilter)
btMultiBodyDynamicsWorld(btDispatcher *dispatcher, btBroadphaseInterface *pairCache, btMultiBodyConstraintSolver *constraintSolver, btCollisionConfiguration *collisionConfiguration)
virtual void clearMultiBodyConstraintForces()
virtual void saveKinematicState(btScalar timeStep)
virtual void applyGravity()
apply gravity, call this once per timestep
virtual void setMultiBodyConstraintSolver(btMultiBodyConstraintSolver *solver)
virtual void debugDrawWorld()
void updateCollisionObjectInterpolationWorldTransforms(btAlignedObjectArray< btQuaternion > &world_to_local, btAlignedObjectArray< btVector3 > &local_origin)
const btVector3 & getBasePos() const
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
void predictPositionsMultiDof(btScalar dt)
void computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar dt, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m, bool isConstraintPass, bool jointFeedbackInWorldSpace, bool jointFeedbackInJointFrame)
void stepPositionsMultiDof(btScalar dt, btScalar *pq=0, btScalar *pqd=0)
const btMultibodyLink & getLink(int index) const
void checkMotionAndSleepIfRequired(btScalar timestep)
bool isBaseKinematic() const
btScalar getLinkMass(int i) const
void addLinkForce(int i, const btVector3 &f)
void updateCollisionObjectWorldTransforms(btAlignedObjectArray< btQuaternion > &world_to_local, btAlignedObjectArray< btVector3 > &local_origin)
bool hasFixedBase() const
void processDeltaVeeMultiDof2()
void clearConstraintForces()
void setPosUpdated(bool updated)
bool isUsingRK4Integration() const
const btMultiBodyLinkCollider * getBaseCollider() const
bool internalNeedsJointFeedback() const
btTransform getBaseWorldTransform() const
btScalar getBaseMass() const
int getNumPosVars() const
virtual int calculateSerializeBufferSize() const
bool isPosUpdated() const
const btQuaternion & getWorldToBaseRot() const
void forwardKinematics(btAlignedObjectArray< btQuaternion > &world_to_local, btAlignedObjectArray< btVector3 > &local_origin)
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
void addBaseForce(const btVector3 &f)
void saveKinematicState(btScalar timeStep)
const btScalar * getVelocityVector() const
void clearForcesAndTorques()
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
const btCollisionObject * getBody0() const
const btCollisionObject * getBody1() const
const btScalar & w() const
Return the w value.
const btScalar & z() const
Return the z value.
const btScalar & y() const
Return the y value.
const btScalar & x() const
Return the x value.
The btRigidBody is the main class for rigid body objects.
virtual btChunk * allocate(size_t size, int numElements)=0
virtual void finishSerialization()=0
virtual void startSerialization()=0
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
virtual void storeIslandActivationState(btCollisionWorld *world)
virtual void updateActivationState(btCollisionWorld *colWorld, btDispatcher *dispatcher)
void buildAndProcessIslands(btDispatcher *dispatcher, btCollisionWorld *collisionWorld, IslandCallback *callback)
btUnionFind & getUnionFind()
TypedConstraint is the baseclass for Bullet constraints and vehicles.
const btRigidBody & getRigidBodyA() const
const btRigidBody & getRigidBodyB() const
btVector3 can be used to represent 3D points and vectors.
const btScalar & z() const
Return the z value.
const btScalar & x() const
Return the x value.
const btScalar & y() const
Return the y value.
virtual void processConstraints(int islandId=-1)
virtual void setup(btContactSolverInfo *solverInfo, btTypedConstraint **sortedConstraints, int numConstraints, btMultiBodyConstraint **sortedMultiBodyConstraints, int numMultiBodyConstraints, btIDebugDraw *debugDrawer)
void setMultiBodyConstraintSolver(btMultiBodyConstraintSolver *solver)
btAlignedObjectArray< btSolverAnalyticsData > m_islandAnalyticsData
class btMultiBodyLinkCollider * m_collider
eFeatherstoneJointType m_jointType
btTransform m_cachedWorldTransform
void updateCacheMultiDof(btScalar *pq=0)
btSpatialMotionVector m_axes[6]