A potential contact between the children of two Fixture objects. More...
#include <Contact.hpp>
Classes | |
struct | UpdateConf |
Update configuration. More... | |
Public Types | |
using | substep_type = TimestepIters |
Substep type. More... | |
Public Member Functions | |
Contact (Fixture *fA, ChildCounter iA, Fixture *fB, ChildCounter iB) | |
Initializing constructor. More... | |
Contact ()=delete | |
Default construction not allowed. More... | |
Contact (const Contact ©)=default | |
Copy constructor. More... | |
const Manifold & | GetManifold () const noexcept |
Gets the contact manifold. More... | |
bool | IsTouching () const noexcept |
Is this contact touching? More... | |
void | SetEnabled (bool flag) noexcept |
Enables or disables this contact. More... | |
void | SetEnabled () noexcept |
Enables this contact. More... | |
void | UnsetEnabled () noexcept |
Disables this contact. More... | |
bool | IsEnabled () const noexcept |
Has this contact been disabled? More... | |
Fixture * | GetFixtureA () const noexcept |
Gets fixture A in this contact. More... | |
ChildCounter | GetChildIndexA () const noexcept |
Get the child primitive index for fixture A. More... | |
Fixture * | GetFixtureB () const noexcept |
Gets fixture B in this contact. More... | |
ChildCounter | GetChildIndexB () const noexcept |
Get the child primitive index for fixture B. More... | |
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. More... | |
void | SetTangentSpeed (LinearVelocity speed) noexcept |
Sets the desired tangent speed for a conveyor belt behavior. More... | |
LinearVelocity | GetTangentSpeed () const noexcept |
Gets the desired tangent speed. More... | |
substep_type | GetToiCount () const noexcept |
Gets the time of impact count. More... | |
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. More... | |
bool | NeedsFiltering () const noexcept |
Whether or not the contact needs filtering. More... | |
void | FlagForUpdating () noexcept |
Flags the contact for updating. More... | |
bool | NeedsUpdating () const noexcept |
Whether or not the contact needs updating. More... | |
Static Public Member Functions | |
static UpdateConf | GetUpdateConf (const StepConf &conf) noexcept |
Gets the update configuration from the given step configuration data. More... | |
Friends | |
class | ContactAtty |
Related Functions | |
(Note that these are not member functions.) | |
AABB | ComputeIntersectingAABB (const Contact &contact) |
Computes the intersecting AABB for the given contact. More... | |
WorldManifold | GetWorldManifold (const Contact &contact) |
Body * | GetBodyA (const Contact &contact) noexcept |
Gets the body A associated with the given contact. More... | |
Body * | GetBodyB (const Contact &contact) noexcept |
Gets the body B associated with the given contact. More... | |
Fixture * | GetFixtureA (const Contact &contact) noexcept |
Gets the fixture A associated with the given contact. More... | |
Fixture * | GetFixtureB (const Contact &contact) noexcept |
Gets the fixture B associated with the given contact. More... | |
ChildCounter | GetChildIndexA (const Contact &contact) noexcept |
Gets the child index A of the given contact. More... | |
ChildCounter | GetChildIndexB (const Contact &contact) noexcept |
Gets the child index B of the given contact. More... | |
bool | HasSensor (const Contact &contact) noexcept |
Whether the given contact has a sensor. More... | |
bool | IsImpenetrable (const Contact &contact) noexcept |
Whether the given contact is "impenetrable". More... | |
bool | IsActive (const Contact &contact) noexcept |
Determines whether the given contact is "active". More... | |
void | SetAwake (const Contact &c) noexcept |
Sets awake the fixtures of the given contact. More... | |
void | ResetFriction (Contact &contact) |
void | ResetRestitution (Contact &contact) noexcept |
TOIOutput | CalcToi (const Contact &contact, ToiConf conf) |
Calculates the Time Of Impact for the given contact with the given configuration. More... | |
Detailed Description
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.
- Note
- These are created by World instances. Users have no need to instantiate these themselves.
- This data structure is 104-bytes large (on at least one 64-bit platform).
- Examples
- Contact.cpp, and World.cpp.
Definition at line 81 of file Contact.hpp.
Member Typedef Documentation
◆ substep_type
Substep type.
Definition at line 86 of file Contact.hpp.
Constructor & Destructor Documentation
◆ Contact() [1/3]
playrho::d2::Contact::Contact | ( | Fixture * | fA, |
ChildCounter | iA, | ||
Fixture * | fB, | ||
ChildCounter | iB | ||
) |
Initializing constructor.
- Parameters
-
fA Non-null pointer 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. fB Non-null pointer 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.
- Note
- This need never be called directly by a user.
- Warning
- Behavior is undefined if
fA
is null. -
Behavior is undefined if
fB
is null. -
Behavior is undefined if
fA == fB
. - Behavior is undefined if both fixture's have the same body.
Definition at line 60 of file Contact.cpp.
◆ Contact() [2/3]
|
delete |
Default construction not allowed.
◆ Contact() [3/3]
|
default |
Copy constructor.
Member Function Documentation
◆ GetUpdateConf()
|
staticnoexcept |
Gets the update configuration from the given step configuration data.
Definition at line 55 of file Contact.cpp.
◆ GetManifold()
|
inlinenoexcept |
◆ IsTouching()
|
inlinenoexcept |
Is this contact touching?
Touching is defined as either:
- This contact's manifold has more than 0 contact points, or
- This contact has sensors and the two shapes of this contact are found to be overlapping.
- Returns
- true if this contact is said to be touching, false otherwise.
- Examples
- World.cpp.
Definition at line 380 of file Contact.hpp.
◆ SetEnabled() [1/2]
|
inlinenoexcept |
Enables or disables this contact.
- Note
- 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).
Definition at line 353 of file Contact.hpp.
◆ SetEnabled() [2/2]
|
inlinenoexcept |
Enables this contact.
Definition at line 365 of file Contact.hpp.
◆ UnsetEnabled()
|
inlinenoexcept |
Disables this contact.
Definition at line 370 of file Contact.hpp.
◆ IsEnabled()
|
inlinenoexcept |
Has this contact been disabled?
Definition at line 375 of file Contact.hpp.
◆ GetFixtureA()
|
inlinenoexcept |
◆ GetChildIndexA()
|
inlinenoexcept |
Get the child primitive index for fixture A.
Definition at line 516 of file Contact.hpp.
◆ GetFixtureB()
|
inlinenoexcept |
◆ GetChildIndexB()
|
inlinenoexcept |
Get the child primitive index for fixture B.
Definition at line 521 of file Contact.hpp.
◆ SetFriction()
|
inlinenoexcept |
Sets the friction value for this contact.
Override the default friction mixture.
- Note
- You can call this in
ContactListener::PreSolve
. - This value persists until set or reset.
- Warning
- Behavior is undefined if given a negative friction value.
- Parameters
-
friction Co-efficient of friction value of zero or greater.
Definition at line 437 of file Contact.hpp.
◆ GetFriction()
|
inlinenoexcept |
Gets the coefficient of friction.
Gets the combined friction of the two fixtures associated with this contact.
- Returns
- Value of 0 or higher.
- See also
- MixFriction.
Definition at line 443 of file Contact.hpp.
◆ SetRestitution()
|
inlinenoexcept |
Sets the restitution.
This override the default restitution mixture.
- Note
- You can call this in
ContactListener::PreSolve
. - The value persists until you set or reset.
Definition at line 448 of file Contact.hpp.
◆ GetRestitution()
|
inlinenoexcept |
Gets the restitution.
Definition at line 453 of file Contact.hpp.
◆ SetTangentSpeed()
|
inlinenoexcept |
Sets the desired tangent speed for a conveyor belt behavior.
Definition at line 458 of file Contact.hpp.
◆ GetTangentSpeed()
|
inlinenoexcept |
Gets the desired tangent speed.
Definition at line 463 of file Contact.hpp.
◆ GetToiCount()
|
inlinenoexcept |
◆ HasValidToi()
|
inlinenoexcept |
Gets whether a TOI is set.
- Returns
- true if this object has a TOI set for it, false otherwise.
- Examples
- World.cpp.
Definition at line 468 of file Contact.hpp.
◆ GetToi()
|
inline |
Gets the time of impact (TOI) as a fraction.
- Note
- This is only valid if a TOI has been set.
- See also
- void SetToi(Real toi).
- Returns
- Time of impact fraction in the range of 0 to 1 if set (where 1 means no actual impact in current time slot), otherwise undefined.
Definition at line 473 of file Contact.hpp.
◆ FlagForFiltering()
|
inlinenoexcept |
Flags the contact for filtering.
Definition at line 407 of file Contact.hpp.
◆ NeedsFiltering()
|
inlinenoexcept |
Whether or not the contact needs filtering.
Definition at line 417 of file Contact.hpp.
◆ FlagForUpdating()
|
inlinenoexcept |
Flags the contact for updating.
Definition at line 422 of file Contact.hpp.
◆ NeedsUpdating()
|
inlinenoexcept |
Whether or not the contact needs updating.
Definition at line 432 of file Contact.hpp.
Friends And Related Function Documentation
◆ ContactAtty
|
friend |
Definition at line 217 of file Contact.hpp.
◆ ComputeIntersectingAABB()
◆ GetWorldManifold()
|
related |
Gets the world manifold for the given data.
- Note
- This is a convenience function that in turn calls the
GetWorldManifold(const Manifold&, const Transformation&, const Real, const Transformation& xfB, const Real)
function.
- Parameters
-
contact Contact to return a world manifold for.
- Returns
- World manifold value for the given inputs which will have the same number of points as the given manifold has. The returned world manifold points will be the mid-points of the contact's intersection.
Definition at line 126 of file WorldManifold.cpp.
◆ GetBodyA()
Gets the body A associated with the given contact.
Definition at line 227 of file Contact.cpp.
◆ GetBodyB()
Gets the body B associated with the given contact.
Definition at line 232 of file Contact.cpp.
◆ GetFixtureA()
Gets the fixture A associated with the given contact.
Definition at line 541 of file Contact.hpp.
◆ GetFixtureB()
Gets the fixture B associated with the given contact.
Definition at line 548 of file Contact.hpp.
◆ GetChildIndexA()
|
related |
Gets the child index A of the given contact.
Definition at line 555 of file Contact.hpp.
◆ GetChildIndexB()
|
related |
Gets the child index B of the given contact.
Definition at line 562 of file Contact.hpp.
◆ HasSensor()
|
related |
Whether the given contact has a sensor.
Definition at line 237 of file Contact.cpp.
◆ IsImpenetrable()
|
related |
Whether the given contact is "impenetrable".
Definition at line 242 of file Contact.cpp.
◆ IsActive()
|
related |
Determines whether the given contact is "active".
Definition at line 249 of file Contact.cpp.
◆ SetAwake()
|
related |
Sets awake the fixtures of the given contact.
Definition at line 264 of file Contact.cpp.
◆ ResetFriction()
|
related |
Resets the friction mixture to the default value.
Definition at line 271 of file Contact.cpp.
◆ ResetRestitution()
|
related |
Reset the restitution to the default value.
Definition at line 277 of file Contact.cpp.
◆ CalcToi()
Calculates the Time Of Impact for the given contact with the given configuration.
Definition at line 284 of file Contact.cpp.
The documentation for this class was generated from the following files:
- Dynamics/Contacts/Contact.hpp
- Collision/AABB.hpp
- Collision/WorldManifold.hpp
- Dynamics/Contacts/Contact.cpp