Bullet Collision Detection & Physics Library
btMultiBodyDynamicsWorld.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2013 Erwin Coumans http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_MULTIBODY_DYNAMICS_WORLD_H
17#define BT_MULTIBODY_DYNAMICS_WORLD_H
18
21
22#define BT_USE_VIRTUAL_CLEARFORCES_AND_GRAVITY
23
24class btMultiBody;
28
32{
33protected:
39
40 //cached data to avoid memory allocations
48
49 virtual void calculateSimulationIslands();
50 virtual void updateActivationState(btScalar timeStep);
51
52
53 virtual void serializeMultiBodies(btSerializer* serializer);
54
55public:
56 btMultiBodyDynamicsWorld(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btMultiBodyConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration);
57
59
60 virtual void solveConstraints(btContactSolverInfo& solverInfo);
61
63
64 virtual void removeMultiBody(btMultiBody* body);
65
66 virtual int getNumMultibodies() const
67 {
68 return m_multiBodies.size();
69 }
70
72 {
73 return m_multiBodies[mbIndex];
74 }
75
76 const btMultiBody* getMultiBody(int mbIndex) const
77 {
78 return m_multiBodies[mbIndex];
79 }
80
81 virtual void addMultiBodyConstraint(btMultiBodyConstraint* constraint);
82
83 virtual int getNumMultiBodyConstraints() const
84 {
86 }
87
88 virtual btMultiBodyConstraint* getMultiBodyConstraint(int constraintIndex)
89 {
90 return m_multiBodyConstraints[constraintIndex];
91 }
92
93 virtual const btMultiBodyConstraint* getMultiBodyConstraint(int constraintIndex) const
94 {
95 return m_multiBodyConstraints[constraintIndex];
96 }
97
98 virtual void removeMultiBodyConstraint(btMultiBodyConstraint* constraint);
99
100 virtual void integrateTransforms(btScalar timeStep);
103
104 virtual void predictUnconstraintMotion(btScalar timeStep);
105 virtual void debugDrawWorld();
106
107 virtual void debugDrawMultiBodyConstraint(btMultiBodyConstraint* constraint);
108
109 void forwardKinematics();
110 virtual void clearForces();
111 virtual void clearMultiBodyConstraintForces();
112 virtual void clearMultiBodyForces();
113 virtual void applyGravity();
114
115 virtual void serialize(btSerializer* serializer);
117 virtual void setConstraintSolver(btConstraintSolver* solver);
118 virtual void getAnalyticsData(btAlignedObjectArray<struct btSolverAnalyticsData>& m_islandAnalyticsData) const;
119
120 virtual void solveExternalForces(btContactSolverInfo& solverInfo);
121 virtual void solveInternalConstraints(btContactSolverInfo& solverInfo);
122 void buildIslands();
123
124 virtual void saveKinematicState(btScalar timeStep);
125};
126#endif //BT_MULTIBODY_DYNAMICS_WORLD_H
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
int size() const
return the number of elements in the array
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size,...
btDiscreteDynamicsWorld provides discrete rigid body simulation those classes replace the obsolete Cc...
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:77
The btMultiBodyDynamicsWorld adds Featherstone multi body dynamics to Bullet This implementation is s...
virtual btMultiBodyConstraint * getMultiBodyConstraint(int constraintIndex)
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
btMultiBody * getMultiBody(int mbIndex)
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...
btAlignedObjectArray< btVector3 > m_scratch_local_origin1
virtual void serializeMultiBodies(btSerializer *serializer)
virtual void addMultiBodyConstraint(btMultiBodyConstraint *constraint)
btAlignedObjectArray< btVector3 > m_scratch_v
const btMultiBody * getMultiBody(int mbIndex) const
virtual void predictUnconstraintMotion(btScalar timeStep)
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 int getNumMultibodies() const
virtual void solveExternalForces(btContactSolverInfo &solverInfo)
virtual void setConstraintSolver(btConstraintSolver *solver)
btAlignedObjectArray< btVector3 > m_scratch_local_origin
virtual int getNumMultiBodyConstraints() const
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 saveKinematicState(btScalar timeStep)
virtual void applyGravity()
apply gravity, call this once per timestep
virtual void setMultiBodyConstraintSolver(btMultiBodyConstraintSolver *solver)
virtual const btMultiBodyConstraint * getMultiBodyConstraint(int constraintIndex) const