Bullet Collision Detection & Physics Library: btMultiBodyDynamicsWorld.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btMultiBodyDynamicsWorld.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2013 Erwin Coumans http://bulletphysics.org
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 1. 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. 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
19 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
20
21 #define BT_USE_VIRTUAL_CLEARFORCES_AND_GRAVITY
22
23 class btMultiBody;
24 class btMultiBodyConstraint;
25 class btMultiBodyConstraintSolver;
26 struct MultiBodyInplaceSolverIslandCallback;
27
30 class btMultiBodyDynamicsWorld : public btDiscreteDynamicsWorld
31 {
32 protected:
33 btAlignedObjectArray<btMultiBody*> m_multiBodies;
34 btAlignedObjectArray<btMultiBodyConstraint*> m_multiBodyConstraints;
35 btAlignedObjectArray<btMultiBodyConstraint*> m_sortedMultiBodyConstraints;
36 btMultiBodyConstraintSolver* m_multiBodyConstraintSolver;
37 MultiBodyInplaceSolverIslandCallback* m_solverMultiBodyIslandCallback;
38
39 virtual void calculateSimulationIslands();
40 virtual void updateActivationState(btScalar timeStep);
41 virtual void solveConstraints(btContactSolverInfo& solverInfo);
42
43 virtual void serializeMultiBodies(btSerializer* serializer);
44
45 public:
46
47 btMultiBodyDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btMultiBodyConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration);
48
49 virtual ~btMultiBodyDynamicsWorld ();
50
51 virtual void addMultiBody(btMultiBody* body, short group= btBroadphaseProxy::DefaultFilter, short mask=btBroadphaseProxy::AllFilter);
52
53 virtual void removeMultiBody(btMultiBody* body);
54
55 virtual int getNumMultibodies() const
56 {
57 return m_multiBodies.size();
58 }
59
60 btMultiBody* getMultiBody(int mbIndex)
61 {
62 return m_multiBodies[mbIndex];
63 }
64
65 virtual void addMultiBodyConstraint( btMultiBodyConstraint* constraint);
66
67 virtual int getNumMultiBodyConstraints() const
68 {
69 return m_multiBodyConstraints.size();
70 }
71
72 virtual btMultiBodyConstraint* getMultiBodyConstraint( int constraintIndex)
73 {
74 return m_multiBodyConstraints[constraintIndex];
75 }
76
77 virtual const btMultiBodyConstraint* getMultiBodyConstraint( int constraintIndex) const
78 {
79 return m_multiBodyConstraints[constraintIndex];
80 }
81
82 virtual void removeMultiBodyConstraint( btMultiBodyConstraint* constraint);
83
84 virtual void integrateTransforms(btScalar timeStep);
85
86 virtual void debugDrawWorld();
87
88 virtual void debugDrawMultiBodyConstraint(btMultiBodyConstraint* constraint);
89
90 void forwardKinematics();
91 virtual void clearForces();
92 virtual void clearMultiBodyConstraintForces();
93 virtual void clearMultiBodyForces();
94 virtual void applyGravity();
95
96 virtual void serialize(btSerializer* serializer);
97
98 };
99 #endif //BT_MULTIBODY_DYNAMICS_WORLD_H
btMultiBodyDynamicsWorld::updateActivationState
virtual void updateActivationState(btScalar timeStep)
Definition: btMultiBodyDynamicsWorld.cpp:124
btMultiBodyDynamicsWorld::debugDrawMultiBodyConstraint
virtual void debugDrawMultiBodyConstraint(btMultiBodyConstraint *constraint)
Definition: btMultiBodyDynamicsWorld.cpp:798
btMultiBodyDynamicsWorld::serialize
virtual void serialize(btSerializer *serializer)
Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (see B...
Definition: btMultiBodyDynamicsWorld.cpp:967
btAlignedObjectArray< btMultiBody * >
btMultiBodyDynamicsWorld::clearForces
virtual void clearForces()
the forces on each rigidbody is accumulating together with gravity. clear this after each timestep...
Definition: btMultiBodyDynamicsWorld.cpp:955
btDiscreteDynamicsWorld
btDiscreteDynamicsWorld provides discrete rigid body simulation those classes replace the obsolete Cc...
Definition: btDiscreteDynamicsWorld.h:37
btCollisionConfiguration
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size...
Definition: btCollisionConfiguration.h:26
btMultiBodyDynamicsWorld::debugDrawWorld
virtual void debugDrawWorld()
Definition: btMultiBodyDynamicsWorld.cpp:804
btMultiBodyDynamicsWorld::integrateTransforms
virtual void integrateTransforms(btScalar timeStep)
Definition: btMultiBodyDynamicsWorld.cpp:728
btMultiBody
Definition: btMultiBody.h:51
btMultiBodyConstraint
Definition: btMultiBodyConstraint.h:42
btSerializer
Definition: btSerializer.h:68
btMultiBodyDynamicsWorld::m_multiBodyConstraintSolver
btMultiBodyConstraintSolver * m_multiBodyConstraintSolver
Definition: btMultiBodyDynamicsWorld.h:36
btMultiBodyDynamicsWorld::m_solverMultiBodyIslandCallback
MultiBodyInplaceSolverIslandCallback * m_solverMultiBodyIslandCallback
Definition: btMultiBodyDynamicsWorld.h:37
btMultiBodyDynamicsWorld::clearMultiBodyConstraintForces
virtual void clearMultiBodyConstraintForces()
Definition: btMultiBodyDynamicsWorld.cpp:918
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:155
btMultiBodyDynamicsWorld::~btMultiBodyDynamicsWorld
virtual ~btMultiBodyDynamicsWorld()
Definition: btMultiBodyDynamicsWorld.cpp:392
btMultiBodyDynamicsWorld::removeMultiBodyConstraint
virtual void removeMultiBodyConstraint(btMultiBodyConstraint *constraint)
Definition: btMultiBodyDynamicsWorld.cpp:793
btMultiBodyDynamicsWorld::getMultiBody
btMultiBody * getMultiBody(int mbIndex)
Definition: btMultiBodyDynamicsWorld.h:60
btMultiBodyConstraintSolver
Definition: btMultiBodyConstraintSolver.h:30
btMultiBodyDynamicsWorld::applyGravity
virtual void applyGravity()
apply gravity, call this once per timestep
Definition: btMultiBodyDynamicsWorld.cpp:884
btBroadphaseInterface
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs...
Definition: btBroadphaseInterface.h:51
btMultiBodyDynamicsWorld::solveConstraints
virtual void solveConstraints(btContactSolverInfo &solverInfo)
Definition: btMultiBodyDynamicsWorld.cpp:408
btMultiBodyDynamicsWorld::m_multiBodies
btAlignedObjectArray< btMultiBody * > m_multiBodies
Definition: btMultiBodyDynamicsWorld.h:33
btMultiBodyDynamicsWorld::m_multiBodyConstraints
btAlignedObjectArray< btMultiBodyConstraint * > m_multiBodyConstraints
Definition: btMultiBodyDynamicsWorld.h:34
btMultiBodyDynamicsWorld::btMultiBodyDynamicsWorld
btMultiBodyDynamicsWorld(btDispatcher *dispatcher, btBroadphaseInterface *pairCache, btMultiBodyConstraintSolver *constraintSolver, btCollisionConfiguration *collisionConfiguration)
Definition: btMultiBodyDynamicsWorld.cpp:382
btMultiBodyDynamicsWorld::serializeMultiBodies
virtual void serializeMultiBodies(btSerializer *serializer)
Definition: btMultiBodyDynamicsWorld.cpp:983
btContactSolverInfo
Definition: btContactSolverInfo.h:65
btMultiBodyDynamicsWorld::m_sortedMultiBodyConstraints
btAlignedObjectArray< btMultiBodyConstraint * > m_sortedMultiBodyConstraints
Definition: btMultiBodyDynamicsWorld.h:35
btMultiBodyDynamicsWorld::addMultiBody
virtual void addMultiBody(btMultiBody *body, short group=btBroadphaseProxy::DefaultFilter, short mask=btBroadphaseProxy::AllFilter)
Definition: btMultiBodyDynamicsWorld.cpp:27
btMultiBodyDynamicsWorld::clearMultiBodyForces
virtual void clearMultiBodyForces()
Definition: btMultiBodyDynamicsWorld.cpp:926
btMultiBodyDynamicsWorld::getMultiBodyConstraint
virtual btMultiBodyConstraint * getMultiBodyConstraint(int constraintIndex)
Definition: btMultiBodyDynamicsWorld.h:72
btMultiBodyDynamicsWorld::getMultiBodyConstraint
virtual const btMultiBodyConstraint * getMultiBodyConstraint(int constraintIndex) const
Definition: btMultiBodyDynamicsWorld.h:77
btMultiBodyDynamicsWorld::getNumMultiBodyConstraints
virtual int getNumMultiBodyConstraints() const
Definition: btMultiBodyDynamicsWorld.h:67
btMultiBodyDynamicsWorld::removeMultiBody
virtual void removeMultiBody(btMultiBody *body)
Definition: btMultiBodyDynamicsWorld.cpp:33
btMultiBodyDynamicsWorld::forwardKinematics
void forwardKinematics()
Definition: btMultiBodyDynamicsWorld.cpp:397
btBroadphaseProxy::DefaultFilter
Definition: btBroadphaseProxy.h:93
btBroadphaseProxy::AllFilter
Definition: btBroadphaseProxy.h:99
btDiscreteDynamicsWorld.h
btMultiBodyDynamicsWorld::addMultiBodyConstraint
virtual void addMultiBodyConstraint(btMultiBodyConstraint *constraint)
Definition: btMultiBodyDynamicsWorld.cpp:788
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:69
btMultiBodyDynamicsWorld::getNumMultibodies
virtual int getNumMultibodies() const
Definition: btMultiBodyDynamicsWorld.h:55
btMultiBodyDynamicsWorld
The btMultiBodyDynamicsWorld adds Featherstone multi body dynamics to Bullet This implementation is s...
Definition: btMultiBodyDynamicsWorld.h:30
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:278
btMultiBodyDynamicsWorld::calculateSimulationIslands
virtual void calculateSimulationIslands()
Definition: btMultiBodyDynamicsWorld.cpp:38
MultiBodyInplaceSolverIslandCallback
Definition: btMultiBodyDynamicsWorld.cpp:226