A potential contact between the children of two Fixture objects. More...
#include <Contact.hpp>
Public Types | |
enum | : FlagsType { e_touchingFlag = 0x01, e_enabledFlag = 0x02, e_filterFlag = 0x04, e_toiFlag = 0x08, e_dirtyFlag = 0x10, e_sensorFlag = 0x20, e_activeFlag = 0x40, e_impenetrableFlag = 0x80 } |
Flags stored in m_flags. More... | |
using | substep_type = TimestepIters |
Substep type. | |
using | FlagsType = std::uint8_t |
Flags type data type. | |
Public Member Functions | |
Contact () noexcept=default | |
Default construction not allowed. | |
Contact (BodyID bA, FixtureID fA, ChildCounter iA, BodyID bB, FixtureID fB, ChildCounter iB) noexcept | |
Initializing constructor. More... | |
bool | IsTouching () const noexcept |
Is this contact touching? More... | |
void | SetTouching () noexcept |
Sets the touching flag state. More... | |
void | UnsetTouching () noexcept |
Unsets the touching flag state. | |
void | SetEnabled (bool flag) noexcept |
Enables or disables this contact. More... | |
bool | IsEnabled () const noexcept |
Has this contact been disabled? | |
void | SetEnabled () noexcept |
Enables this contact. | |
void | UnsetEnabled () noexcept |
Disables this contact. | |
BodyID | GetBodyA () const noexcept |
Gets the body-A identifier. | |
FixtureID | GetFixtureA () const noexcept |
Gets fixture A in this contact. | |
ChildCounter | GetChildIndexA () const noexcept |
Get the child primitive index for fixture A. | |
BodyID | GetBodyB () const noexcept |
Gets the body-B identifier. | |
FixtureID | GetFixtureB () const noexcept |
Gets fixture B in this contact. | |
ChildCounter | GetChildIndexB () const noexcept |
Get the child primitive index for fixture B. | |
void | SetFriction (Real friction) noexcept |
Sets the friction value for this contact. More... | |
Real | GetFriction () const noexcept |
Gets the coefficient of friction. More... | |
void | SetRestitution (Real restitution) noexcept |
Sets the restitution. More... | |
Real | GetRestitution () const noexcept |
Gets the restitution. | |
void | SetTangentSpeed (LinearVelocity speed) noexcept |
Sets the desired tangent speed for a conveyor belt behavior. | |
LinearVelocity | GetTangentSpeed () const noexcept |
Gets the desired tangent speed. | |
substep_type | GetToiCount () const noexcept |
Gets the time of impact count. | |
bool | HasValidToi () const noexcept |
Gets whether a TOI is set. More... | |
Real | GetToi () const |
Gets the time of impact (TOI) as a fraction. More... | |
void | FlagForFiltering () noexcept |
Flags the contact for filtering. | |
bool | NeedsFiltering () const noexcept |
Whether or not the contact needs filtering. | |
void | FlagForUpdating () noexcept |
Flags the contact for updating. | |
bool | NeedsUpdating () const noexcept |
Whether or not the contact needs updating. | |
bool | IsSensor () const noexcept |
Whether or not this contact is a "sensor". More... | |
void | SetIsSensor () noexcept |
Sets the sensor state of this contact. More... | |
void | UnsetIsSensor () noexcept |
Unsets the sensor state of this contact. | |
bool | IsImpenetrable () const noexcept |
Whether or not this contact is "impenetrable". More... | |
void | SetImpenetrable () noexcept |
Sets the impenetrability of this contact. More... | |
void | UnsetImpenetrable () noexcept |
Unsets the impenetrability of this contact. | |
bool | IsActive () const noexcept |
Whether or not this contact is "active". More... | |
void | SetIsActive () noexcept |
Sets the active state of this contact. More... | |
void | UnsetIsActive () noexcept |
Unsets the active state of this contact. More... | |
void | UnflagForFiltering () noexcept |
Flags this contact for filtering. More... | |
void | UnflagForUpdating () noexcept |
Unflags this contact for updating. | |
void | SetToi (Real toi) noexcept |
Sets the time of impact (TOI). More... | |
void | UnsetToi () noexcept |
Unsets the TOI. | |
void | SetToiCount (substep_type value) noexcept |
Sets the TOI count to the given value. | |
void | IncrementToiCount () noexcept |
Increments the TOI count. | |
Private Attributes | |
BodyID | m_bodyA = InvalidBodyID |
Identifier of body A. More... | |
BodyID | m_bodyB = InvalidBodyID |
Identifier of body B. More... | |
FixtureID | m_fixtureA = InvalidFixtureID |
Identifier of fixture A. More... | |
FixtureID | m_fixtureB = InvalidFixtureID |
Identifier of fixture B. More... | |
ChildCounter | m_indexA |
Index A. 4-bytes. | |
ChildCounter | m_indexB |
Index B. 4-bytes. | |
Real | m_friction = 0 |
Mix of frictions of associated fixtures. More... | |
Real | m_restitution = 0 |
Mix of restitutions of associated fixtures. More... | |
LinearVelocity | m_tangentSpeed = 0 |
Tangent speed. More... | |
Real | m_toi = 0 |
Time of impact. More... | |
substep_type | m_toiCount = 0 |
Count of TOI calculations contact has gone through since last reset. | |
FlagsType | m_flags = e_enabledFlag | e_dirtyFlag |
Flags. | |
Related Functions | |
(Note that these are not member functions.) | |
AABB | ComputeIntersectingAABB (const World &world, const Contact &contact) |
Computes the intersecting AABB for the given contact. | |
WorldManifold | GetWorldManifold (const World &world, const Contact &contact, const Manifold &manifold) |
Gets the world manifold for the given data. More... | |
BodyID | GetBodyA (const Contact &contact) noexcept |
Gets the body A ID of the given contact. | |
BodyID | GetBodyB (const Contact &contact) noexcept |
Gets the body B ID of the given contact. | |
FixtureID | GetFixtureA (const Contact &contact) noexcept |
Gets the fixture A associated with the given contact. | |
FixtureID | GetFixtureB (const Contact &contact) noexcept |
Gets the fixture B associated with the given contact. | |
ChildCounter | GetChildIndexA (const Contact &contact) noexcept |
Gets the child index A of the given contact. | |
ChildCounter | GetChildIndexB (const Contact &contact) noexcept |
Gets the child index B of the given contact. | |
bool | IsImpenetrable (const Contact &contact) noexcept |
Whether the given contact is "impenetrable". | |
bool | IsActive (const Contact &contact) noexcept |
Determines whether the given contact is "active". | |
bool | IsEnabled (const Contact &contact) noexcept |
Gets whether the given contact is enabled or not. | |
bool | IsTouching (const Contact &contact) noexcept |
Gets whether the given contact is touching or not. | |
bool | IsSensor (const Contact &contact) noexcept |
Gets whether the given contact is for sensors or not. | |
auto | GetToiCount (const Contact &contact) noexcept |
Gets the time of impact count. | |
auto | NeedsFiltering (const Contact &contact) noexcept |
Whether or not the contact needs filtering. | |
auto | NeedsUpdating (const Contact &contact) noexcept |
Whether or not the contact needs updating. | |
auto | HasValidToi (const Contact &contact) noexcept |
Gets whether a TOI is set. More... | |
Real | GetToi (const Contact &contact) noexcept |
Gets the time of impact (TOI) as a fraction. More... | |
auto | GetFriction (const Contact &contact) noexcept |
Gets the coefficient of friction. More... | |
void | SetFriction (Contact &contact, Real value) noexcept |
Sets the friction value for the identified contact. More... | |
auto | GetRestitution (const Contact &contact) noexcept |
Gets the coefficient of restitution. More... | |
void | SetRestitution (Contact &contact, Real value) |
Sets the restitution value for the identified contact. More... | |
auto | GetTangentSpeed (const Contact &contact) noexcept |
Gets the desired tangent speed. More... | |
void | SetTangentSpeed (Contact &contact, LinearVelocity value) noexcept |
Sets the desired tangent speed for a conveyor belt behavior. More... | |
A potential contact between the children of two Fixture objects.
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 actual contact points.
anonymous enum : FlagsType |
|
noexcept |
Initializing constructor.
bA | Identifier of body-A. |
fA | Non-invalid identifier to fixture A that must have a shape and may not be the same or have the same body as the other fixture. |
iA | Child index A. |
bB | Identifier of body-B. |
fB | Non-invalid identifier to fixture B that must have a shape and may not be the same or have the same body as the other fixture. |
iB | Child index B. |
fA
is null. fB
is null. fA == fB
.
|
inlinenoexcept |
Gets the coefficient of friction.
Gets the combined friction of the two fixtures associated with this contact.
|
inline |
Gets the time of impact (TOI) as a fraction.
|
inlinenoexcept |
Gets whether a TOI is set.
Referenced by GetToi().
|
inlinenoexcept |
Whether or not this contact is "active".
|
inlinenoexcept |
Whether or not this contact is "impenetrable".
|
inlinenoexcept |
Whether or not this contact is a "sensor".
|
inlinenoexcept |
Is this contact touching?
Touching is defined as either:
|
inlinenoexcept |
Enables or disables this contact.
|
inlinenoexcept |
Sets the friction value for this contact.
Override the default friction mixture.
friction | Co-efficient of friction value of zero or greater. |
|
inlinenoexcept |
Sets the impenetrability of this contact.
|
inlinenoexcept |
Sets the active state of this contact.
|
inlinenoexcept |
Sets the sensor state of this contact.
|
inlinenoexcept |
Sets the restitution.
This override the default restitution mixture.
Referenced by playrho::d2::SetRestitution().
|
inlinenoexcept |
Sets the time of impact (TOI).
After returning, this object will have a TOI that is set as indicated by HasValidToi()
.
toi | Time of impact as a fraction between 0 and 1 where 1 indicates no actual impact in the current time slot. |
|
inlinenoexcept |
Sets the touching flag state.
|
inlinenoexcept |
Flags this contact for filtering.
|
inlinenoexcept |
Unsets the active state of this contact.
|
related |
Gets the coefficient of friction.
|
related |
Gets the coefficient of restitution.
|
related |
Gets the desired tangent speed.
std::out_of_range | If given an invalid contact identifier. |
Gets the time of impact (TOI) as a fraction.
|
related |
Gets the world manifold for the given data.
GetWorldManifold(const Manifold&, const Transformation&, const Real, const Transformation& xfB, const Real)
function.world | World that the result is to be relative to. |
contact | Contact to return a world manifold for. |
manifold | The manifold to covert to a world manifold. |
|
related |
Sets the friction value for the identified contact.
Overrides the default friction mixture.
contact | The contact whose friction should be set. |
value | Co-efficient of friction value of zero or greater. |
std::out_of_range | If given an invalid contact identifier. |
Sets the restitution value for the identified contact.
This override the default restitution mixture.
std::out_of_range | If given an invalid contact identifier. |
|
related |
Sets the desired tangent speed for a conveyor belt behavior.
std::out_of_range | If given an invalid contact identifier. |
|
private |
Identifier of body A.
Referenced by GetBodyA().
|
private |
Identifier of body B.
Referenced by GetBodyB().
|
private |
|
private |
|
private |
Mix of frictions of associated fixtures.
Referenced by GetFriction(), and SetFriction().
|
private |
Mix of restitutions of associated fixtures.
Referenced by GetRestitution(), and SetRestitution().
|
private |
Tangent speed.
Referenced by GetTangentSpeed(), and SetTangentSpeed().
|
private |