Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
b2Contact Class Referenceabstract

`#include <b2Contact.h>`

Inheritance diagram for b2Contact:

## Public Member Functions
b2Manifold * | GetManifold ()
const b2Manifold * | GetManifold () const
void | GetWorldManifold (b2WorldManifold *worldManifold) const
| Get the world manifold. More...
bool | IsTouching () const
| Is this contact touching? More...
void | SetEnabled (bool flag)
bool | IsEnabled () const
| Has this contact been disabled? More...
b2Contact * | GetNext ()
| Get the next contact in the world's contact list. More...
const b2Contact * | GetNext () const
b2Fixture * | GetFixtureA ()
| Get fixture A in this contact. More...
const b2Fixture * | GetFixtureA () const
int32 | GetChildIndexA () const
| Get the child primitive index for fixture A. More...
b2Fixture * | GetFixtureB ()
| Get fixture B in this contact. More...
const b2Fixture * | GetFixtureB () const
int32 | GetChildIndexB () const
| Get the child primitive index for fixture B. More...
void | SetFriction (float32 friction)
float32 | GetFriction () const
| Get the friction. More...
void | ResetFriction ()
| Reset the friction mixture to the default value. More...
void | SetRestitution (float32 restitution)
float32 | GetRestitution () const
| Get the restitution. More...
void | ResetRestitution ()
| Reset the restitution to the default value. More...
void | SetTangentSpeed (float32 speed)
| Set the desired tangent speed for a conveyor belt behavior. In meters per second. More...
float32 | GetTangentSpeed () const
| Get the desired tangent speed. In meters per second. More...
virtual void | Evaluate (b2Manifold *manifold, const b2Transform &xfA, const b2Transform &xfB)=0
| Evaluate this contact with your own manifold and transforms. More...

## Protected Types
enum | { e_islandFlag = 0x0001, e_touchingFlag = 0x0002, e_enabledFlag = 0x0004, e_filterFlag = 0x0008, e_bulletHitFlag = 0x0010, e_toiFlag = 0x0020 }

## Protected Member Functions
void | FlagForFiltering ()
| Flag this contact for filtering. Filtering will occur the next time step. More...
| b2Contact ()
| b2Contact (b2Fixture *fixtureA, int32 indexA, b2Fixture *fixtureB, int32 indexB)
virtual | ~b2Contact ()
void | Update (b2ContactListener *listener)

## Static Protected Member Functions
static void | AddType (b2ContactCreateFcn *createFcn, b2ContactDestroyFcn *destroyFcn, b2Shape::Type typeA, b2Shape::Type typeB)
static void | InitializeRegisters ()
static b2Contact * | Create (b2Fixture *fixtureA, int32 indexA, b2Fixture *fixtureB, int32 indexB, b2BlockAllocator *allocator)
static void | Destroy (b2Contact *contact, b2Shape::Type typeA, b2Shape::Type typeB, b2BlockAllocator *allocator)
static void | Destroy (b2Contact *contact, b2BlockAllocator *allocator)

## Protected Attributes
uint32 | m_flags
b2Contact * | m_prev
b2Contact * | m_next
b2ContactEdge | m_nodeA
b2ContactEdge | m_nodeB
b2Fixture * | m_fixtureA
b2Fixture * | m_fixtureB
int32 | m_indexA
int32 | m_indexB
b2Manifold | m_manifold
int32 | m_toiCount
float32 | m_toi
float32 | m_friction
float32 | m_restitution
float32 | m_tangentSpeed

## Static Protected Attributes
static b2ContactRegister | s_registers [b2Shape::e_typeCount][b2Shape::e_typeCount]
static bool | s_initialized = false

## Friends
class | b2ContactManager
class | b2World
class | b2ContactSolver
class | b2Body
class | b2Fixture

## Detailed Description

The class manages contact between two shapes. A contact exists for each overlapping AABB in the broad-phase (except if filtered). Therefore a contact object may exist that has no contact points.

## Member Enumeration Documentation

anonymous enum
| protected

Enumerator
e_islandFlag |
e_touchingFlag |
e_enabledFlag |
e_filterFlag |
e_bulletHitFlag |
e_toiFlag |

## Constructor & Destructor Documentation

b2Contact | ( |  | ) |
| inline protected

b2Contact | ( | b2Fixture * | fixtureA,
|  | int32 | indexA,
|  | b2Fixture * | fixtureB,
|  | int32 | indexB
| ) |  |
| protected

virtual ~b2Contact | ( |  | ) |
| inline protected virtual

## Member Function Documentation

void AddType | ( | b2ContactCreateFcn * | createFcn,
|  | b2ContactDestroyFcn * | destroyFcn,
|  | b2Shape::Type | typeA,
|  | b2Shape::Type | typeB
| ) |  |
| static protected

b2Contact * Create | ( | b2Fixture * | fixtureA,
|  | int32 | indexA,
|  | b2Fixture * | fixtureB,
|  | int32 | indexB,
|  | b2BlockAllocator * | allocator
| ) |  |
| static protected

static void Destroy | ( | b2Contact * | contact,
|  | b2Shape::Type | typeA,
|  | b2Shape::Type | typeB,
|  | b2BlockAllocator * | allocator
| ) |  |
| static protected

void Destroy | ( | b2Contact * | contact,
|  | b2BlockAllocator * | allocator
| ) |  |
| static protected

virtual void Evaluate | ( | b2Manifold * | manifold,
|  | const b2Transform & | xfA,
|  | const b2Transform & | xfB
| ) |  |
| pure virtual

Evaluate this contact with your own manifold and transforms.

Implemented in b2ChainAndCircleContact, b2ChainAndPolygonContact, b2CircleContact, b2EdgeAndCircleContact, b2EdgeAndPolygonContact, b2PolygonContact, and b2PolygonAndCircleContact.

void FlagForFiltering | ( |  | ) |
| inline protected

Flag this contact for filtering. Filtering will occur the next time step.

int32 GetChildIndexA | ( |  | ) | const
| inline

Get the child primitive index for fixture A.

int32 GetChildIndexB | ( |  | ) | const
| inline

Get the child primitive index for fixture B.

b2Fixture * GetFixtureA | ( |  | ) |
| inline

Get fixture A in this contact.

const b2Fixture * GetFixtureA | ( |  | ) | const
| inline

b2Fixture * GetFixtureB | ( |  | ) |
| inline

Get fixture B in this contact.

const b2Fixture * GetFixtureB | ( |  | ) | const
| inline

float32 GetFriction | ( |  | ) | const
| inline

Get the friction.

b2Manifold * GetManifold | ( |  | ) |
| inline

Get the contact manifold. Do not modify the manifold unless you understand the internals of Box2D.

const b2Manifold * GetManifold | ( |  | ) | const
| inline

b2Contact * GetNext | ( |  | ) |
| inline

Get the next contact in the world's contact list.

const b2Contact * GetNext | ( |  | ) | const
| inline

float32 GetRestitution | ( |  | ) | const
| inline

Get the restitution.

float32 GetTangentSpeed | ( |  | ) | const
| inline

Get the desired tangent speed. In meters per second.

void GetWorldManifold | ( | b2WorldManifold * | worldManifold | ) | const
| inline

Get the world manifold.

void InitializeRegisters | ( |  | ) |
| static protected

bool IsEnabled | ( |  | ) | const
| inline

Has this contact been disabled?

bool IsTouching | ( |  | ) | const
| inline

Is this contact touching?

void ResetFriction | ( |  | ) |
| inline

Reset the friction mixture to the default value.

void ResetRestitution | ( |  | ) |
| inline

Reset the restitution to the default value.

void SetEnabled | ( | bool | flag | ) |
| inline

Enable/disable this contact. This can be used inside the pre-solve contact listener. The contact is only disabled for the current time step (or sub-step in continuous collisions).

void SetFriction | ( | float32 | friction | ) |
| inline

Override the default friction mixture. You can call this in b2ContactListener::PreSolve. This value persists until set or reset.

void SetRestitution | ( | float32 | restitution | ) |
| inline

Override the default restitution mixture. You can call this in b2ContactListener::PreSolve. The value persists until you set or reset.

void SetTangentSpeed | ( | float32 | speed | ) |
| inline

Set the desired tangent speed for a conveyor belt behavior. In meters per second.

void Update | ( | b2ContactListener * | listener | ) |
| protected

## Friends And Related Function Documentation

friend class b2Body
| friend

friend class b2ContactManager
| friend

friend class b2ContactSolver
| friend

friend class b2Fixture
| friend

friend class b2World
| friend

## Member Data Documentation

b2Fixture* m_fixtureA
| protected

b2Fixture* m_fixtureB
| protected

uint32 m_flags
| protected

float32 m_friction
| protected

int32 m_indexA
| protected

int32 m_indexB
| protected

b2Manifold m_manifold
| protected

b2Contact* m_next
| protected

b2ContactEdge m_nodeA
| protected

b2ContactEdge m_nodeB
| protected

b2Contact* m_prev
| protected

float32 m_restitution
| protected

float32 m_tangentSpeed
| protected

float32 m_toi
| protected

int32 m_toiCount
| protected

bool s_initialized = false
| static protected

b2ContactRegister s_registers
| static protected

The documentation for this class was generated from the following files:

- Box2D/Dynamics/Contacts/b2Contact.h
- Box2D/Dynamics/Contacts/b2Contact.cpp