An association between a body and a shape. More...
#include <Fixture.hpp>
Public Member Functions | |
NonNull< Body * > | GetBody () const noexcept |
Gets the parent body of this fixture. More... | |
Shape | GetShape () const noexcept |
Gets the child shape. More... | |
void | SetSensor (bool sensor) noexcept |
Set if this fixture is a sensor. More... | |
bool | IsSensor () const noexcept |
Is this fixture a sensor (non-solid)? More... | |
void | SetFilterData (Filter filter) |
Sets the contact filtering data. More... | |
Filter | GetFilterData () const noexcept |
Gets the contact filtering data. More... | |
void | Refilter () |
Re-filter the fixture. More... | |
void * | GetUserData () const noexcept |
void | SetUserData (void *data) noexcept |
Sets the user data. More... | |
AreaDensity | GetDensity () const noexcept |
Gets the density of this fixture. More... | |
Real | GetFriction () const noexcept |
Gets the coefficient of friction. More... | |
Real | GetRestitution () const noexcept |
Gets the coefficient of restitution. More... | |
ChildCounter | GetProxyCount () const noexcept |
Gets the proxy count. More... | |
FixtureProxy | GetProxy (ChildCounter index) const noexcept |
Gets the proxy for the given index. More... | |
Span< const FixtureProxy > | GetProxies () const noexcept |
Gets the proxies. More... | |
Friends | |
class | FixtureAtty |
Related Functions | |
(Note that these are not member functions.) | |
AABB | ComputeAABB (const Fixture &fixture) noexcept |
Computes the AABB for the given fixture. More... | |
MassData | GetMassData (const Fixture &f) |
Computes the mass data for the given fixture. More... | |
bool | TestPoint (const Fixture &f, Length2 p) noexcept |
Tests a point for containment in a fixture. More... | |
void | SetAwake (const Fixture &f) noexcept |
Sets the associated body's sleep status to awake. More... | |
Transformation | GetTransformation (const Fixture &f) noexcept |
Gets the transformation associated with the given fixture. More... | |
bool | ShouldCollide (const Fixture &fixtureA, const Fixture &fixtureB) noexcept |
Whether contact calculations should be performed between the two fixtures. More... | |
FixtureConf | GetFixtureConf (const Fixture &fixture) noexcept |
Gets the fixture definition for the given fixture. More... | |
Detailed Description
An association between a body and a shape.
A fixture is used to attach a shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as collision filters, etc.
- Warning
- you cannot reuse fixtures.
- Note
- Fixtures should be created using the
Body::CreateFixture
method. -
Destroy these using the
Body::Destroy(Fixture*, bool)
method. - This structure is 56-bytes large (using a 4-byte Real on at least one 64-bit architecture/build).
- Examples
- World.cpp.
Definition at line 61 of file Fixture.hpp.
Member Function Documentation
◆ GetBody()
Gets the parent body of this fixture.
- Returns
- Non-null pointer to the parent body.
- Examples
- World.cpp.
Definition at line 227 of file Fixture.hpp.
◆ GetShape()
|
inlinenoexcept |
Gets the child shape.
The shape is not modifiable. Use a new fixture instead.
Definition at line 202 of file Fixture.hpp.
◆ SetSensor()
|
noexcept |
Set if this fixture is a sensor.
Definition at line 60 of file Fixture.cpp.
◆ IsSensor()
|
inlinenoexcept |
Is this fixture a sensor (non-solid)?
- Returns
- the true if the shape is a sensor.
Definition at line 207 of file Fixture.hpp.
◆ SetFilterData()
|
inline |
Sets the contact filtering data.
- Note
- This won't update contacts until the next time step when either parent body is speedable and awake.
-
This automatically calls
Refilter
.
Definition at line 237 of file Fixture.hpp.
◆ GetFilterData()
|
inlinenoexcept |
Gets the contact filtering data.
Definition at line 212 of file Fixture.hpp.
◆ Refilter()
void playrho::d2::Fixture::Refilter | ( | ) |
Re-filter the fixture.
- Note
- Call this if you want to establish collision that was previously disabled by
ShouldCollide(const Fixture&, const Fixture&)
.
- See also
- bool ShouldCollide(const Fixture& fixtureA, const Fixture& fixtureB) noexcept
Definition at line 40 of file Fixture.cpp.
◆ GetUserData()
|
inlinenoexcept |
Get the user data that was assigned in the fixture definition. Use this to store your application specific data.
Definition at line 217 of file Fixture.hpp.
◆ SetUserData()
|
inlinenoexcept |
Sets the user data.
- Note
- Use this to store your application specific data.
Definition at line 222 of file Fixture.hpp.
◆ GetDensity()
|
inlinenoexcept |
Gets the density of this fixture.
- Returns
- Non-negative density (in mass per area).
Definition at line 288 of file Fixture.hpp.
◆ GetFriction()
|
inlinenoexcept |
Gets the coefficient of friction.
- Returns
- Value of 0 or higher.
Definition at line 278 of file Fixture.hpp.
◆ GetRestitution()
|
inlinenoexcept |
Gets the coefficient of restitution.
Definition at line 283 of file Fixture.hpp.
◆ GetProxyCount()
|
inlinenoexcept |
Gets the proxy count.
- Note
- This will be zero until a world step has been run since this fixture's creation.
Definition at line 232 of file Fixture.hpp.
◆ GetProxy()
|
noexcept |
Gets the proxy for the given index.
- Warning
- Behavior is undefined if given an invalid index.
- Returns
- Fixture proxy value.
Definition at line 34 of file Fixture.cpp.
◆ GetProxies()
|
inlinenoexcept |
Gets the proxies.
Definition at line 243 of file Fixture.hpp.
Friends And Related Function Documentation
◆ FixtureAtty
|
friend |
Definition at line 128 of file Fixture.hpp.
◆ ComputeAABB()
◆ GetMassData()
Computes the mass data for the given fixture.
The mass data is based on the density and the shape of the fixture. The rotational inertia is about the shape's origin.
- Note
- This operation may be expensive.
- Parameters
-
f Fixture to compute the mass data for.
Definition at line 182 of file MassData.cpp.
◆ SetAwake()
|
related |
Sets the associated body's sleep status to awake.
- Note
- This is a convenience function that simply looks up the fixture's body and calls that body'
SetAwake
method.
- Parameters
-
f Fixture whose body should be awoken.
Definition at line 85 of file Fixture.cpp.
◆ GetTransformation()
|
related |
Gets the transformation associated with the given fixture.
- Warning
- Behavior is undefined if the fixture doesn't have an associated body - i.e. behavior is undefined if the fixture has
nullptr
as its associated body.
- Examples
- Body.cpp.
Definition at line 90 of file Fixture.cpp.
◆ ShouldCollide()
Whether contact calculations should be performed between the two fixtures.
- Returns
true
if contact calculations should be performed between these two fixtures;false
otherwise.
Definition at line 319 of file Fixture.hpp.
◆ GetFixtureConf()
|
related |
Gets the fixture definition for the given fixture.
- Parameters
-
fixture Fixture to get the definition for.
Definition at line 28 of file FixtureConf.cpp.
The documentation for this class was generated from the following files:
- Dynamics/Fixture.hpp
- Collision/AABB.hpp
- Collision/MassData.hpp
- Dynamics/Fixture.cpp
- Dynamics/FixtureConf.hpp