Box2D
3.0.0
A Real-Time-Oriented 2-D Physics Engine
|
An interface for "listeners" for contacts. More...
#include <WorldCallbacks.hpp>
Public Types | |
using | iteration_type = unsigned |
Public Member Functions | |
virtual | ~ContactListener () |
virtual void | BeginContact (Contact &contact) |
Called when two fixtures begin to touch. More... | |
virtual void | EndContact (Contact &contact) |
End contact callback. More... | |
virtual void | PreSolve (Contact &contact, const Manifold &oldManifold) |
Pre-solve callback. More... | |
virtual void | PostSolve (Contact &contact, const ContactImpulsesList &impulse, iteration_type solved) |
Post-solve callback. More... | |
An interface for "listeners" for contacts.
Implement this class to get contact information. You can use these results for things like sounds and game logic. You can also get contact results by traversing the contact lists after the time step. However, you might miss some contacts because continuous physics leads to sub-stepping. Additionally you may receive multiple callbacks for the same contact in a single time step. You should strive to make your callbacks efficient because there may be many callbacks per time step.
using box2d::ContactListener::iteration_type = unsigned |
|
inlinevirtual |
|
inlinevirtual |
Called when two fixtures begin to touch.
|
inlinevirtual |
End contact callback.
Called when the contact's "touching" property becomes false, or just before the contact is destroyed.
contact | Contact that's about to be destroyed or whose "touching" property has become false. |
|
inlinevirtual |
Post-solve callback.
This lets you inspect a contact after the solver is finished. This is useful for inspecting impulses.
|
inlinevirtual |
Pre-solve callback.
This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. disable contact). A copy of the old manifold is provided so that you can detect changes.