2
Bullet Continuous Collision Detection and Physics Library
3
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
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:
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.
17
#ifndef BT_MANIFOLD_RESULT_H
18
#define BT_MANIFOLD_RESULT_H
20
class btCollisionObject;
21
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
22
class btManifoldPoint;
24
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
26
#include "LinearMath/btTransform.h"
28
typedef bool (*ContactAddedCallback)(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1);
29
extern ContactAddedCallback gContactAddedCallback;
31
// XXX Emscripten: Uncomment the next line, to prevent SAFE_HEAP warnings
32
#define DEBUG_PART_INDEX 1
35
///btManifoldResult is a helper class to manage contact results.
36
class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result
40
btPersistentManifold* m_manifoldPtr;
42
//we need this for compounds
43
btTransform m_rootTransA;
44
btTransform m_rootTransB;
46
btCollisionObject* m_body0;
47
btCollisionObject* m_body1;
57
#ifdef DEBUG_PART_INDEX
63
#endif //DEBUG_PART_INDEX
67
btManifoldResult(btCollisionObject* body0,btCollisionObject* body1);
69
virtual ~btManifoldResult() {};
71
void setPersistentManifold(btPersistentManifold* manifoldPtr)
73
m_manifoldPtr = manifoldPtr;
76
const btPersistentManifold* getPersistentManifold() const
80
btPersistentManifold* getPersistentManifold()
85
virtual void setShapeIdentifiersA(int partId0,int index0)
91
virtual void setShapeIdentifiersB( int partId1,int index1)
98
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth);
100
SIMD_FORCE_INLINE void refreshContactPoints()
102
btAssert(m_manifoldPtr);
103
if (!m_manifoldPtr->getNumContacts())
106
bool isSwapped = m_manifoldPtr->getBody0() != m_body0;
110
m_manifoldPtr->refreshContactPoints(m_rootTransB,m_rootTransA);
113
m_manifoldPtr->refreshContactPoints(m_rootTransA,m_rootTransB);
117
const btCollisionObject* getBody0Internal() const
122
const btCollisionObject* getBody1Internal() const
129
#endif //BT_MANIFOLD_RESULT_H