Torque2D Reference

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

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

Public Types | Public Member Functions | Friends | List of all members
b2BroadPhase Class Reference

`#include <b2BroadPhase.h>`

## Public Types
enum | { e_nullProxy = -1 }

## Public Member Functions
| b2BroadPhase ()
| ~b2BroadPhase ()
int32 | CreateProxy (const b2AABB &aabb, void *userData)
void | DestroyProxy (int32 proxyId)
| Destroy a proxy. It is up to the client to remove any pairs. More...
void | MoveProxy (int32 proxyId, const b2AABB &aabb, const b2Vec2 &displacement)
void | TouchProxy (int32 proxyId)
| Call to trigger a re-processing of it's pairs on the next call to UpdatePairs. More...
const b2AABB & | GetFatAABB (int32 proxyId) const
| Get the fat AABB for a proxy. More...
void * | GetUserData (int32 proxyId) const
| Get user data from a proxy. Returns NULL if the id is invalid. More...
bool | TestOverlap (int32 proxyIdA, int32 proxyIdB) const
| Test overlap of fat AABBs. More...
int32 | GetProxyCount () const
| Get the number of proxies. More...
template<typename T >
void | UpdatePairs (T *callback)
| Update the pairs. This results in pair callbacks. This can only add pairs. More...
template<typename T >
void | Query (T *callback, const b2AABB &aabb) const
template<typename T >
void | RayCast (T *callback, const b2RayCastInput &input) const
int32 | GetTreeHeight () const
| Get the height of the embedded tree. More...
int32 | GetTreeBalance () const
| Get the balance of the embedded tree. More...
float32 | GetTreeQuality () const
| Get the quality metric of the embedded tree. More...
void | ShiftOrigin (const b2Vec2 &newOrigin)

## Friends
class | b2DynamicTree

## Detailed Description

The broad-phase is used for computing pairs and performing volume queries and ray casts. This broad-phase does not persist pairs. Instead, this reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap.

## Member Enumeration Documentation

anonymous enum

Enumerator
e_nullProxy |

## Constructor & Destructor Documentation

b2BroadPhase | ( |  | ) |

~b2BroadPhase | ( |  | ) |

## Member Function Documentation

int32 CreateProxy | ( | const b2AABB & | aabb,
|  | void * | userData
| ) |  |

Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs is called.

void DestroyProxy | ( | int32 | proxyId | ) |

Destroy a proxy. It is up to the client to remove any pairs.

const b2AABB & GetFatAABB | ( | int32 | proxyId | ) | const
| inline

Get the fat AABB for a proxy.

int32 GetProxyCount | ( |  | ) | const
| inline

Get the number of proxies.

int32 GetTreeBalance | ( |  | ) | const
| inline

Get the balance of the embedded tree.

int32 GetTreeHeight | ( |  | ) | const
| inline

Get the height of the embedded tree.

float32 GetTreeQuality | ( |  | ) | const
| inline

Get the quality metric of the embedded tree.

void * GetUserData | ( | int32 | proxyId | ) | const
| inline

Get user data from a proxy. Returns NULL if the id is invalid.

void MoveProxy | ( | int32 | proxyId,
|  | const b2AABB & | aabb,
|  | const b2Vec2 & | displacement
| ) |  |

Call MoveProxy as many times as you like, then when you are done call UpdatePairs to finalized the proxy pairs (for your time step).

void Query | ( | T * | callback,
|  | const b2AABB & | aabb
| ) |  | const
| inline

Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.

void RayCast | ( | T * | callback,
|  | const b2RayCastInput & | input
| ) |  | const
| inline

Ray-cast against the proxies in the tree. This relies on the callback to perform a exact ray-cast in the case were the proxy contains a shape. The callback also performs the any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree.

Parameters

  input | the ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).
  callback | a callback class that is called for each proxy that is hit by the ray.

void ShiftOrigin | ( | const b2Vec2 & | newOrigin | ) |
| inline

Shift the world origin. Useful for large worlds. The shift formula is: position -= newOrigin

Parameters

  newOrigin | the new origin with respect to the old origin

bool TestOverlap | ( | int32 | proxyIdA,
|  | int32 | proxyIdB
| ) |  | const
| inline

Test overlap of fat AABBs.

void TouchProxy | ( | int32 | proxyId | ) |

Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.

void UpdatePairs | ( | T * | callback | ) |

Update the pairs. This results in pair callbacks. This can only add pairs.

## Friends And Related Function Documentation

friend class b2DynamicTree
| friend

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

- Box2D/Collision/b2BroadPhase.h
- Box2D/Collision/b2BroadPhase.cpp