22 #include <Box2D/Common/b2Math.h>
24 #include <Box2D/Collision/Shapes/b2Shape.h>
25 #include <Box2D/Dynamics/b2Fixture.h>
37 inline float32 b2MixFriction(float32 friction1, float32 friction2)
39 return b2Sqrt(friction1 * friction2);
44 inline float32 b2MixRestitution(float32 restitution1, float32 restitution2)
46 return restitution1 > restitution2 ? restitution1 : restitution2;
56 b2ContactCreateFcn* createFcn;
57 b2ContactDestroyFcn* destroyFcn;
158 e_islandFlag = 0x0001,
161 e_touchingFlag = 0x0002,
164 e_enabledFlag = 0x0004,
167 e_filterFlag = 0x0008,
170 e_bulletHitFlag = 0x0010,
179 static void AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destroyFcn,
180 b2Shape::Type typeA, b2Shape::Type typeB);
181 static void InitializeRegisters();
186 b2Contact() : m_fixtureA(NULL), m_fixtureB(NULL) {}
192 static b2ContactRegister s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount];
193 static bool s_initialized;
217 float32 m_restitution;
219 float32 m_tangentSpeed;
246 m_flags |= e_enabledFlag;
250 m_flags &= ~e_enabledFlag;
256 return (m_flags & e_enabledFlag) == e_enabledFlag;
261 return (m_flags & e_touchingFlag) == e_touchingFlag;
306 m_flags |= e_filterFlag;
311 m_friction = friction;
321 m_friction = b2MixFriction(m_fixtureA->m_friction, m_fixtureB->m_friction);
326 m_restitution = restitution;
331 return m_restitution;
336 m_restitution = b2MixRestitution(m_fixtureA->m_restitution, m_fixtureB->m_restitution);
341 m_tangentSpeed = speed;
346 return m_tangentSpeed;
This is used to compute the current state of a contact manifold.
Definition: b2Collision.h:110
Definition: b2StackAllocator.h:37
void Initialize(const b2Manifold *manifold, const b2Transform &xfA, float32 radiusA, const b2Transform &xfB, float32 radiusB)
Definition: b2Collision.cpp:22
Definition: b2BlockAllocator.h:36
b2Body * GetBody()
Definition: b2Fixture.h:278
b2Shape * GetShape()
Definition: b2Fixture.h:248
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:132
Definition: b2Collision.h:93
const b2Transform & GetTransform() const
Definition: b2Body.h:496
Definition: b2Fixture.h:108