Bullet Collision Detection & Physics Library: btSoftMultiBodyDynamicsWorld.cpp Source File

Bullet Collision Detection & Physics Library

btSoftMultiBodyDynamicsWorld.cpp
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans https://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#include "btSoftMultiBodyDynamicsWorld.h"
17#include "LinearMath/btQuickprof.h"
18
19//softbody & helpers
20#include "BulletSoftBody/btSoftBody.h"
21#include "BulletSoftBody/btSoftBodyHelpers.h"
22#include "BulletSoftBody/btSoftBodySolvers.h"
23#include "BulletSoftBody/btDefaultSoftBodySolver.h"
24#include "LinearMath/btSerializer.h"
25
26btSoftMultiBodyDynamicsWorld::btSoftMultiBodyDynamicsWorld(
27 btDispatcher* dispatcher,
28 btBroadphaseInterface* pairCache,
29 btMultiBodyConstraintSolver* constraintSolver,
30 btCollisionConfiguration* collisionConfiguration,
31 btSoftBodySolver* softBodySolver) : btMultiBodyDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration),
32 m_softBodySolver(softBodySolver),
33 m_ownsSolver(false)
34{
35 if (!m_softBodySolver)
36 {
37 void* ptr = btAlignedAlloc(sizeof(btDefaultSoftBodySolver), 16);
38 m_softBodySolver = new (ptr) btDefaultSoftBodySolver();
39 m_ownsSolver = true;
40 }
41
42 m_drawFlags = fDrawFlags::Std;
43 m_drawNodeTree = true;
44 m_drawFaceTree = false;
45 m_drawClusterTree = false;
46 m_sbi.m_broadphase = pairCache;
47 m_sbi.m_dispatcher = dispatcher;
48 m_sbi.m_sparsesdf.Initialize();
49 m_sbi.m_sparsesdf.Reset();
50
51 m_sbi.air_density = (btScalar)1.2;
52 m_sbi.water_density = 0;
53 m_sbi.water_offset = 0;
54 m_sbi.water_normal = btVector3(0, 0, 0);
55 m_sbi.m_gravity.setValue(0, -10, 0);
56
57 m_sbi.m_sparsesdf.Initialize();
58}
59
60btSoftMultiBodyDynamicsWorld::~btSoftMultiBodyDynamicsWorld()
61{
62 if (m_ownsSolver)
63 {
64 m_softBodySolver->~btSoftBodySolver();
65 btAlignedFree(m_softBodySolver);
66 }
67}
68
69 void btSoftMultiBodyDynamicsWorld::predictUnconstraintMotion(btScalar timeStep)
70{
71 btDiscreteDynamicsWorld::predictUnconstraintMotion(timeStep);
72 {
73 BT_PROFILE("predictUnconstraintMotionSoftBody");
74 m_softBodySolver->predictMotion(float(timeStep));
75 }
76}
77
78 void btSoftMultiBodyDynamicsWorld::internalSingleStepSimulation(btScalar timeStep)
79{
80 // Let the solver grab the soft bodies and if necessary optimize for it
81 m_softBodySolver->optimize(getSoftBodyArray());
82
83 if (!m_softBodySolver->checkInitialized())
84 {
85 btAssert("Solver initialization failed\n");
86 }
87
88 btDiscreteDynamicsWorld::internalSingleStepSimulation(timeStep);
89
91 solveSoftBodiesConstraints(timeStep);
92
93 //self collisions
94 for (int i = 0; i < m_softBodies.size(); i++)
95 {
96 btSoftBody* psb = (btSoftBody*)m_softBodies[i];
97 psb->defaultCollisionHandler(psb);
98 }
99
101 m_softBodySolver->updateSoftBodies();
102
103 for (int i = 0; i < m_softBodies.size(); i++)
104 {
105 btSoftBody* psb = (btSoftBody*)m_softBodies[i];
106 psb->interpolateRenderMesh();
107 }
108 // End solver-wise simulation step
109 // ///////////////////////////////
110}
111
112 void btSoftMultiBodyDynamicsWorld::solveSoftBodiesConstraints(btScalar timeStep)
113{
114 BT_PROFILE("solveSoftConstraints");
115
116 if (m_softBodies.size())
117 {
118 btSoftBody::solveClusters(m_softBodies);
119 }
120
121 // Solve constraints solver-wise
122 m_softBodySolver->solveConstraints(timeStep * m_softBodySolver->getTimeScale());
123}
124
125 void btSoftMultiBodyDynamicsWorld::addSoftBody(btSoftBody* body, int collisionFilterGroup, int collisionFilterMask)
126{
127 m_softBodies.push_back(body);
128
129 // Set the soft body solver that will deal with this body
130 // to be the world's solver
131 body->setSoftBodySolver(m_softBodySolver);
132
133 btCollisionWorld::addCollisionObject(body,
134 collisionFilterGroup,
135 collisionFilterMask);
136}
137
138 void btSoftMultiBodyDynamicsWorld::removeSoftBody(btSoftBody* body)
139{
140 m_softBodies.remove(body);
141
142 btCollisionWorld::removeCollisionObject(body);
143}
144
145 void btSoftMultiBodyDynamicsWorld::removeCollisionObject(btCollisionObject* collisionObject)
146{
147 btSoftBody* body = btSoftBody::upcast(collisionObject);
148 if (body)
149 removeSoftBody(body);
150 else
151 btDiscreteDynamicsWorld::removeCollisionObject(collisionObject);
152}
153
154 void btSoftMultiBodyDynamicsWorld::debugDrawWorld()
155{
156 btMultiBodyDynamicsWorld::debugDrawWorld();
157
158 if (getDebugDrawer())
159 {
160 int i;
161 for (i = 0; i < this->m_softBodies.size(); i++)
162 {
163 btSoftBody* psb = (btSoftBody*)this->m_softBodies[i];
164 if (getDebugDrawer() && (getDebugDrawer()->getDebugMode() & (btIDebugDraw::DBG_DrawWireframe)))
165 {
166 btSoftBodyHelpers::DrawFrame(psb, m_debugDrawer);
167 btSoftBodyHelpers::Draw(psb, m_debugDrawer, m_drawFlags);
168 }
169
170 if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawAabb))
171 {
172 if (m_drawNodeTree) btSoftBodyHelpers::DrawNodeTree(psb, m_debugDrawer);
173 if (m_drawFaceTree) btSoftBodyHelpers::DrawFaceTree(psb, m_debugDrawer);
174 if (m_drawClusterTree) btSoftBodyHelpers::DrawClusterTree(psb, m_debugDrawer);
175 }
176 }
177 }
178}
179
180 struct btSoftSingleRayCallback : public btBroadphaseRayCallback
181{
182 btVector3 m_rayFromWorld;
183 btVector3 m_rayToWorld;
184 btTransform m_rayFromTrans;
185 btTransform m_rayToTrans;
186 btVector3 m_hitNormal;
187
188 const btSoftMultiBodyDynamicsWorld* m_world;
189 btCollisionWorld::RayResultCallback& m_resultCallback;
190
191 btSoftSingleRayCallback(const btVector3& rayFromWorld, const btVector3& rayToWorld, const btSoftMultiBodyDynamicsWorld* world, btCollisionWorld::RayResultCallback& resultCallback)
192 : m_rayFromWorld(rayFromWorld),
193 m_rayToWorld(rayToWorld),
194 m_world(world),
195 m_resultCallback(resultCallback)
196 {
197 m_rayFromTrans.setIdentity();
198 m_rayFromTrans.setOrigin(m_rayFromWorld);
199 m_rayToTrans.setIdentity();
200 m_rayToTrans.setOrigin(m_rayToWorld);
201
202 btVector3 rayDir = (rayToWorld - rayFromWorld);
203
204 rayDir.normalize();
206 m_rayDirectionInverse[0] = rayDir[0] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[0];
207 m_rayDirectionInverse[1] = rayDir[1] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[1];
208 m_rayDirectionInverse[2] = rayDir[2] == btScalar(0.0) ? btScalar(1e30) : btScalar(1.0) / rayDir[2];
209 m_signs[0] = m_rayDirectionInverse[0] < 0.0;
210 m_signs[1] = m_rayDirectionInverse[1] < 0.0;
211 m_signs[2] = m_rayDirectionInverse[2] < 0.0;
212
213 m_lambda_max = rayDir.dot(m_rayToWorld - m_rayFromWorld);
214 }
215
216 virtual bool process(const btBroadphaseProxy* proxy)
217 {
219 if (m_resultCallback.m_closestHitFraction == btScalar(0.f))
220 return false;
221
222 btCollisionObject* collisionObject = (btCollisionObject*)proxy->m_clientObject;
223
224 //only perform raycast if filterMask matches
225 if (m_resultCallback.needsCollision(collisionObject->getBroadphaseHandle()))
226 {
227 //RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
228 //btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
229#if 0
230#ifdef RECALCULATE_AABB
231 btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
232 collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
233#else
234 //getBroadphase()->getAabb(collisionObject->getBroadphaseHandle(),collisionObjectAabbMin,collisionObjectAabbMax);
235 const btVector3& collisionObjectAabbMin = collisionObject->getBroadphaseHandle()->m_aabbMin;
236 const btVector3& collisionObjectAabbMax = collisionObject->getBroadphaseHandle()->m_aabbMax;
237#endif
238#endif
239 //btScalar hitLambda = m_resultCallback.m_closestHitFraction;
240 //culling already done by broadphase
241 //if (btRayAabb(m_rayFromWorld,m_rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,m_hitNormal))
242 {
243 m_world->rayTestSingle(m_rayFromTrans, m_rayToTrans,
244 collisionObject,
245 collisionObject->getCollisionShape(),
246 collisionObject->getWorldTransform(),
247 m_resultCallback);
248 }
249 }
250 return true;
251 }
252};
253
254 void btSoftMultiBodyDynamicsWorld::rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const
255{
256 BT_PROFILE("rayTest");
259 btSoftSingleRayCallback rayCB(rayFromWorld, rayToWorld, this, resultCallback);
260
261#ifndef USE_BRUTEFORCE_RAYBROADPHASE
262 m_broadphasePairCache->rayTest(rayFromWorld, rayToWorld, rayCB);
263#else
264 for (int i = 0; i < this->getNumCollisionObjects(); i++)
265 {
266 rayCB.process(m_collisionObjects[i]->getBroadphaseHandle());
267 }
268#endif //USE_BRUTEFORCE_RAYBROADPHASE
269}
270
271 void btSoftMultiBodyDynamicsWorld::rayTestSingle(const btTransform& rayFromTrans, const btTransform& rayToTrans,
272 btCollisionObject* collisionObject,
273 const btCollisionShape* collisionShape,
274 const btTransform& colObjWorldTransform,
275 RayResultCallback& resultCallback)
276{
277 if (collisionShape->isSoftBody())
278 {
279 btSoftBody* softBody = btSoftBody::upcast(collisionObject);
280 if (softBody)
281 {
282 btSoftBody::sRayCast softResult;
283 if (softBody->rayTest(rayFromTrans.getOrigin(), rayToTrans.getOrigin(), softResult))
284 {
285 if (softResult.fraction <= resultCallback.m_closestHitFraction)
286 {
287 btCollisionWorld::LocalShapeInfo shapeInfo;
288 shapeInfo.m_shapePart = 0;
289 shapeInfo.m_triangleIndex = softResult.index;
290 // get the normal
291 btVector3 rayDir = rayToTrans.getOrigin() - rayFromTrans.getOrigin();
292 btVector3 normal = -rayDir;
293 normal.normalize();
294
295 if (softResult.feature == btSoftBody::eFeature::Face)
296 {
297 normal = softBody->m_faces[softResult.index].m_normal;
298 if (normal.dot(rayDir) > 0)
299 {
300 // normal always point toward origin of the ray
301 normal = -normal;
302 }
303 }
304
305 btCollisionWorld::LocalRayResult rayResult(collisionObject,
306 &shapeInfo,
307 normal,
308 softResult.fraction);
309 bool normalInWorldSpace = true;
310 resultCallback.addSingleResult(rayResult, normalInWorldSpace);
311 }
312 }
313 }
314 }
315 else
316 {
317 btCollisionWorld::rayTestSingle(rayFromTrans, rayToTrans, collisionObject, collisionShape, colObjWorldTransform, resultCallback);
318 }
319}
320
321 void btSoftMultiBodyDynamicsWorld::serializeSoftBodies(btSerializer* serializer)
322{
323 int i;
324 //serialize all collision objects
325 for (i = 0; i < m_collisionObjects.size(); i++)
326 {
327 btCollisionObject* colObj = m_collisionObjects[i];
328 if (colObj->getInternalType() & btCollisionObject::CO_SOFT_BODY)
329 {
330 int len = colObj->calculateSerializeBufferSize();
331 btChunk* chunk = serializer->allocate(len, 1);
332 const char* structType = colObj->serialize(chunk->m_oldPtr, serializer);
333 serializer->finalizeChunk(chunk, structType, BT_SOFTBODY_CODE, colObj);
334 }
335 }
336}
337
338 void btSoftMultiBodyDynamicsWorld::serialize(btSerializer* serializer)
339{
340 serializer->startSerialization();
341
342 serializeDynamicsWorldInfo(serializer);
343
344 serializeSoftBodies(serializer);
345
346 serializeMultiBodies(serializer);
347
348 serializeRigidBodies(serializer);
349
350 serializeCollisionObjects(serializer);
351
352 serializeContactManifolds(serializer);
353
354 serializer->finishSerialization();
355}
btAlignedFree
#define btAlignedFree(ptr)
Definition btAlignedAllocator.h:47
btAlignedAlloc
#define btAlignedAlloc(size, alignment)
Definition btAlignedAllocator.h:46
btDefaultSoftBodySolver.h
btQuickprof.h
BT_PROFILE
#define BT_PROFILE(name)
Definition btQuickprof.h:198
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
btAssert
#define btAssert(x)
Definition btScalar.h:153
btSerializer.h
BT_SOFTBODY_CODE
#define BT_SOFTBODY_CODE
Definition btSerializer.h:110
btSoftBodyHelpers.h
btSoftBodySolvers.h
btSoftBody.h
btSoftMultiBodyDynamicsWorld.h
btBroadphaseInterface
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
Definition btBroadphaseInterface.h:50
btChunk
Definition btSerializer.h:48
btChunk::m_oldPtr
void * m_oldPtr
Definition btSerializer.h:52
btCollisionConfiguration
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size,...
Definition btCollisionConfiguration.h:27
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition btCollisionObject.h:51
btCollisionObject::serialize
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition btCollisionObject.cpp:81
btCollisionObject::CO_SOFT_BODY
@ CO_SOFT_BODY
Definition btCollisionObject.h:152
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition btCollisionObject.h:379
btCollisionObject::getBroadphaseHandle
btBroadphaseProxy * getBroadphaseHandle()
Definition btCollisionObject.h:395
btCollisionObject::getInternalType
int getInternalType() const
reserved for Bullet internal usage
Definition btCollisionObject.h:374
btCollisionObject::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition btCollisionObject.h:685
btCollisionObject::getCollisionShape
const btCollisionShape * getCollisionShape() const
Definition btCollisionObject.h:228
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition btCollisionShape.h:28
btCollisionShape::isSoftBody
bool isSoftBody() const
Definition btCollisionShape.h:87
btCollisionShape::getAabb
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
btCollisionWorld::getDebugDrawer
virtual btIDebugDraw * getDebugDrawer()
Definition btCollisionWorld.h:155
btCollisionWorld::m_broadphasePairCache
btBroadphaseInterface * m_broadphasePairCache
Definition btCollisionWorld.h:94
btCollisionWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
Definition btCollisionWorld.cpp:238
btCollisionWorld::addCollisionObject
virtual void addCollisionObject(btCollisionObject *collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
Definition btCollisionWorld.cpp:124
btCollisionWorld::m_collisionObjects
btAlignedObjectArray< btCollisionObject * > m_collisionObjects
Definition btCollisionWorld.h:88
btCollisionWorld::getNumCollisionObjects
int getNumCollisionObjects() const
Definition btCollisionWorld.h:427
btCollisionWorld::m_debugDrawer
btIDebugDraw * m_debugDrawer
Definition btCollisionWorld.h:96
btCollisionWorld::serializeContactManifolds
void serializeContactManifolds(btSerializer *serializer)
Definition btCollisionWorld.cpp:1595
btCollisionWorld::rayTestSingle
static void rayTestSingle(const btTransform &rayFromTrans, const btTransform &rayToTrans, btCollisionObject *collisionObject, const btCollisionShape *collisionShape, const btTransform &colObjWorldTransform, RayResultCallback &resultCallback)
rayTestSingle performs a raycast call and calls the resultCallback.
Definition btCollisionWorld.cpp:276
btCollisionWorld::serializeCollisionObjects
void serializeCollisionObjects(btSerializer *serializer)
Definition btCollisionWorld.cpp:1565
btDefaultSoftBodySolver
Definition btDefaultSoftBodySolver.h:24
btDiscreteDynamicsWorld::serializeRigidBodies
void serializeRigidBodies(btSerializer *serializer)
Definition btDiscreteDynamicsWorld.cpp:1379
btDiscreteDynamicsWorld::internalSingleStepSimulation
virtual void internalSingleStepSimulation(btScalar timeStep)
Definition btDiscreteDynamicsWorld.cpp:452
btDiscreteDynamicsWorld::serializeDynamicsWorldInfo
void serializeDynamicsWorldInfo(btSerializer *serializer)
Definition btDiscreteDynamicsWorld.cpp:1405
btDiscreteDynamicsWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise ca...
Definition btDiscreteDynamicsWorld.cpp:522
btDiscreteDynamicsWorld::predictUnconstraintMotion
virtual void predictUnconstraintMotion(btScalar timeStep)
Definition btDiscreteDynamicsWorld.cpp:1091
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition btDispatcher.h:77
btIDebugDraw::DBG_DrawWireframe
@ DBG_DrawWireframe
Definition btIDebugDraw.h:55
btIDebugDraw::DBG_DrawAabb
@ DBG_DrawAabb
Definition btIDebugDraw.h:56
btMultiBodyConstraintSolver
Definition btMultiBodyConstraintSolver.h:30
btMultiBodyDynamicsWorld::serializeMultiBodies
virtual void serializeMultiBodies(btSerializer *serializer)
Definition btMultiBodyDynamicsWorld.cpp:851
btMultiBodyDynamicsWorld::btMultiBodyDynamicsWorld
btMultiBodyDynamicsWorld(btDispatcher *dispatcher, btBroadphaseInterface *pairCache, btMultiBodyConstraintSolver *constraintSolver, btCollisionConfiguration *collisionConfiguration)
Definition btMultiBodyDynamicsWorld.cpp:184
btMultiBodyDynamicsWorld::debugDrawWorld
virtual void debugDrawWorld()
Definition btMultiBodyDynamicsWorld.cpp:679
btSerializer
Definition btSerializer.h:66
btSerializer::allocate
virtual btChunk * allocate(size_t size, int numElements)=0
btSerializer::finishSerialization
virtual void finishSerialization()=0
btSerializer::startSerialization
virtual void startSerialization()=0
btSerializer::finalizeChunk
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
btSoftBodySolver
Definition btSoftBodySolvers.h:29
btSoftBody
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
Definition btSoftBody.h:75
btSoftBody::interpolateRenderMesh
void interpolateRenderMesh()
Definition btSoftBody.cpp:3824
btSoftBody::defaultCollisionHandler
void defaultCollisionHandler(const btCollisionObjectWrapper *pcoWrap)
Definition btSoftBody.cpp:4085
btSoftBody::rayTest
bool rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, sRayCast &results)
Ray casting using rayFrom and rayTo in worldspace, (not direction!).
Definition btSoftBody.cpp:2039
btSoftBody::setSoftBodySolver
void setSoftBodySolver(btSoftBodySolver *softBodySolver)
Definition btSoftBody.h:1132
btSoftBody::m_faces
tFaceArray m_faces
Definition btSoftBody.h:817
btSoftBody::solveClusters
static void solveClusters(const btAlignedObjectArray< btSoftBody * > &bodies)
Definition btSoftBody.cpp:2319
btSoftBody::upcast
static const btSoftBody * upcast(const btCollisionObject *colObj)
Definition btSoftBody.h:1157
btSoftMultiBodyDynamicsWorld
Definition btSoftMultiBodyDynamicsWorld.h:30
btSoftMultiBodyDynamicsWorld::m_ownsSolver
bool m_ownsSolver
Definition btSoftMultiBodyDynamicsWorld.h:39
btSoftMultiBodyDynamicsWorld::m_softBodySolver
btSoftBodySolver * m_softBodySolver
Solver classes that encapsulate multiple soft bodies for solving.
Definition btSoftMultiBodyDynamicsWorld.h:38
btSoftMultiBodyDynamicsWorld::getSoftBodyArray
btSoftBodyArray & getSoftBodyArray()
Definition btSoftMultiBodyDynamicsWorld.h:81
btSoftMultiBodyDynamicsWorld::predictUnconstraintMotion
virtual void predictUnconstraintMotion(btScalar timeStep)
Definition btSoftMultiBodyDynamicsWorld.cpp:69
btSoftMultiBodyDynamicsWorld::rayTestSingle
static void rayTestSingle(const btTransform &rayFromTrans, const btTransform &rayToTrans, btCollisionObject *collisionObject, const btCollisionShape *collisionShape, const btTransform &colObjWorldTransform, RayResultCallback &resultCallback)
rayTestSingle performs a raycast call and calls the resultCallback.
Definition btSoftMultiBodyDynamicsWorld.cpp:271
btSoftMultiBodyDynamicsWorld::m_drawClusterTree
bool m_drawClusterTree
Definition btSoftMultiBodyDynamicsWorld.h:35
btSoftMultiBodyDynamicsWorld::removeSoftBody
void removeSoftBody(btSoftBody *body)
Definition btSoftMultiBodyDynamicsWorld.cpp:138
btSoftMultiBodyDynamicsWorld::m_sbi
btSoftBodyWorldInfo m_sbi
Definition btSoftMultiBodyDynamicsWorld.h:36
btSoftMultiBodyDynamicsWorld::internalSingleStepSimulation
virtual void internalSingleStepSimulation(btScalar timeStep)
Definition btSoftMultiBodyDynamicsWorld.cpp:78
btSoftMultiBodyDynamicsWorld::debugDrawWorld
virtual void debugDrawWorld()
Definition btSoftMultiBodyDynamicsWorld.cpp:154
btSoftMultiBodyDynamicsWorld::serialize
virtual void serialize(btSerializer *serializer)
Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (see B...
Definition btSoftMultiBodyDynamicsWorld.cpp:338
btSoftMultiBodyDynamicsWorld::m_drawFlags
int m_drawFlags
Definition btSoftMultiBodyDynamicsWorld.h:32
btSoftMultiBodyDynamicsWorld::~btSoftMultiBodyDynamicsWorld
virtual ~btSoftMultiBodyDynamicsWorld()
Definition btSoftMultiBodyDynamicsWorld.cpp:60
btSoftMultiBodyDynamicsWorld::m_softBodies
btSoftBodyArray m_softBodies
Definition btSoftMultiBodyDynamicsWorld.h:31
btSoftMultiBodyDynamicsWorld::solveSoftBodiesConstraints
void solveSoftBodiesConstraints(btScalar timeStep)
Definition btSoftMultiBodyDynamicsWorld.cpp:112
btSoftMultiBodyDynamicsWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise ca...
Definition btSoftMultiBodyDynamicsWorld.cpp:145
btSoftMultiBodyDynamicsWorld::addSoftBody
void addSoftBody(btSoftBody *body, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
Definition btSoftMultiBodyDynamicsWorld.cpp:125
btSoftMultiBodyDynamicsWorld::rayTest
virtual void rayTest(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, RayResultCallback &resultCallback) const
rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback This ...
Definition btSoftMultiBodyDynamicsWorld.cpp:254
btSoftMultiBodyDynamicsWorld::m_drawNodeTree
bool m_drawNodeTree
Definition btSoftMultiBodyDynamicsWorld.h:33
btSoftMultiBodyDynamicsWorld::btSoftMultiBodyDynamicsWorld
btSoftMultiBodyDynamicsWorld(btDispatcher *dispatcher, btBroadphaseInterface *pairCache, btMultiBodyConstraintSolver *constraintSolver, btCollisionConfiguration *collisionConfiguration, btSoftBodySolver *softBodySolver=0)
Definition btSoftMultiBodyDynamicsWorld.cpp:26
btSoftMultiBodyDynamicsWorld::m_drawFaceTree
bool m_drawFaceTree
Definition btSoftMultiBodyDynamicsWorld.h:34
btSoftMultiBodyDynamicsWorld::serializeSoftBodies
void serializeSoftBodies(btSerializer *serializer)
Definition btSoftMultiBodyDynamicsWorld.cpp:321
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition btTransform.h:30
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition btTransform.h:114
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:82
btVector3::dot
btScalar dot(const btVector3 &v) const
Return the dot product.
Definition btVector3.h:229
btVector3::normalize
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
Definition btVector3.h:303
btBroadphaseProxy
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
Definition btBroadphaseProxy.h:86
btBroadphaseProxy::m_aabbMin
btVector3 m_aabbMin
Definition btBroadphaseProxy.h:108
btBroadphaseProxy::m_clientObject
void * m_clientObject
Definition btBroadphaseProxy.h:102
btBroadphaseProxy::m_aabbMax
btVector3 m_aabbMax
Definition btBroadphaseProxy.h:109
btBroadphaseRayCallback::m_rayDirectionInverse
btVector3 m_rayDirectionInverse
added some cached data to accelerate ray-AABB tests
Definition btBroadphaseInterface.h:34
btBroadphaseRayCallback::m_signs
unsigned int m_signs[3]
Definition btBroadphaseInterface.h:35
btBroadphaseRayCallback::m_lambda_max
btScalar m_lambda_max
Definition btBroadphaseInterface.h:36
btBroadphaseRayCallback::btBroadphaseRayCallback
btBroadphaseRayCallback()
Definition btBroadphaseInterface.h:41
btCollisionWorld::LocalRayResult
Definition btCollisionWorld.h:176
btCollisionWorld::LocalShapeInfo
LocalShapeInfo gives extra information for complex shapes Currently, only btTriangleMeshShape is avai...
Definition btCollisionWorld.h:167
btCollisionWorld::LocalShapeInfo::m_triangleIndex
int m_triangleIndex
Definition btCollisionWorld.h:169
btCollisionWorld::LocalShapeInfo::m_shapePart
int m_shapePart
Definition btCollisionWorld.h:168
btCollisionWorld::RayResultCallback
RayResultCallback is used to report new raycast results.
Definition btCollisionWorld.h:196
btCollisionWorld::RayResultCallback::m_closestHitFraction
btScalar m_closestHitFraction
Definition btCollisionWorld.h:197
btCollisionWorld::RayResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalRayResult &rayResult, bool normalInWorldSpace)=0
btSoftBodyHelpers::DrawNodeTree
static void DrawNodeTree(btSoftBody *psb, btIDebugDraw *idraw, int mindepth=0, int maxdepth=-1)
Definition btSoftBodyHelpers.cpp:466
btSoftBodyHelpers::DrawFaceTree
static void DrawFaceTree(btSoftBody *psb, btIDebugDraw *idraw, int mindepth=0, int maxdepth=-1)
Definition btSoftBodyHelpers.cpp:475
btSoftBodyHelpers::DrawClusterTree
static void DrawClusterTree(btSoftBody *psb, btIDebugDraw *idraw, int mindepth=0, int maxdepth=-1)
Definition btSoftBodyHelpers.cpp:484
btSoftBodyHelpers::Draw
static void Draw(btSoftBody *psb, btIDebugDraw *idraw, int drawflags=fDrawFlags::Std)
Definition btSoftBodyHelpers.cpp:172
btSoftBodyHelpers::DrawFrame
static void DrawFrame(btSoftBody *psb, btIDebugDraw *idraw)
Definition btSoftBodyHelpers.cpp:667
btSoftBody::eFeature::Face
@ Face
Definition btSoftBody.h:145
btSoftBody::sRayCast
Definition btSoftBody.h:202
btSoftBody::sRayCast::feature
eFeature::_ feature
soft body
Definition btSoftBody.h:204
btSoftBody::sRayCast::fraction
btScalar fraction
feature index
Definition btSoftBody.h:206
btSoftBody::sRayCast::index
int index
feature type
Definition btSoftBody.h:205
btSoftSingleRayCallback
Definition btSoftMultiBodyDynamicsWorld.cpp:181
btSoftSingleRayCallback::m_rayToWorld
btVector3 m_rayToWorld
Definition btSoftMultiBodyDynamicsWorld.cpp:183
btSoftSingleRayCallback::m_rayFromTrans
btTransform m_rayFromTrans
Definition btSoftMultiBodyDynamicsWorld.cpp:184
btSoftSingleRayCallback::m_hitNormal
btVector3 m_hitNormal
Definition btSoftMultiBodyDynamicsWorld.cpp:186
btSoftSingleRayCallback::m_world
const btSoftMultiBodyDynamicsWorld * m_world
Definition btSoftMultiBodyDynamicsWorld.cpp:188
btSoftSingleRayCallback::btSoftSingleRayCallback
btSoftSingleRayCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const btSoftMultiBodyDynamicsWorld *world, btCollisionWorld::RayResultCallback &resultCallback)
Definition btSoftMultiBodyDynamicsWorld.cpp:191
btSoftSingleRayCallback::m_rayFromWorld
btVector3 m_rayFromWorld
Definition btSoftMultiBodyDynamicsWorld.cpp:182
btSoftSingleRayCallback::m_rayToTrans
btTransform m_rayToTrans
Definition btSoftMultiBodyDynamicsWorld.cpp:185
btSoftSingleRayCallback::m_resultCallback
btCollisionWorld::RayResultCallback & m_resultCallback
Definition btSoftMultiBodyDynamicsWorld.cpp:189
btSoftSingleRayCallback::process
virtual bool process(const btBroadphaseProxy *proxy)
Definition btSoftMultiBodyDynamicsWorld.cpp:216
fDrawFlags::Std
@ Std
Definition btSoftBodyHelpers.h:45