Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
b2Fixture Class Reference

#include <b2_fixture.h>

Public Member Functions

void Dump (int32 bodyIndex)
 Dump this fixture to the log file. More...
 
const b2AABBGetAABB (int32 childIndex) const
 
b2BodyGetBody ()
 
const b2BodyGetBody () const
 
float GetDensity () const
 Get the density of this fixture. More...
 
const b2FilterGetFilterData () const
 Get the contact filtering data. More...
 
float GetFriction () const
 Get the coefficient of friction. More...
 
void GetMassData (b2MassData *massData) const
 
b2FixtureGetNext ()
 
const b2FixtureGetNext () const
 
float GetRestitution () const
 Get the coefficient of restitution. More...
 
float GetRestitutionThreshold () const
 Get the restitution velocity threshold. More...
 
b2ShapeGetShape ()
 
const b2ShapeGetShape () const
 
b2Shape::Type GetType () const
 
b2FixtureUserDataGetUserData ()
 
bool IsSensor () const
 
bool RayCast (b2RayCastOutput *output, const b2RayCastInput &input, int32 childIndex) const
 
void Refilter ()
 Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide. More...
 
void SetDensity (float density)
 
void SetFilterData (const b2Filter &filter)
 
void SetFriction (float friction)
 
void SetRestitution (float restitution)
 
void SetRestitutionThreshold (float threshold)
 
void SetSensor (bool sensor)
 Set if this fixture is a sensor. More...
 
bool TestPoint (const b2Vec2 &p) const
 

Protected Member Functions

 b2Fixture ()
 
void Create (b2BlockAllocator *allocator, b2Body *body, const b2FixtureDef *def)
 
void CreateProxies (b2BroadPhase *broadPhase, const b2Transform &xf)
 
void Destroy (b2BlockAllocator *allocator)
 
void DestroyProxies (b2BroadPhase *broadPhase)
 
void Synchronize (b2BroadPhase *broadPhase, const b2Transform &xf1, const b2Transform &xf2)
 

Protected Attributes

b2Bodym_body
 
float m_density
 
b2Filter m_filter
 
float m_friction
 
bool m_isSensor
 
b2Fixturem_next
 
b2FixtureProxym_proxies
 
int32 m_proxyCount
 
float m_restitution
 
float m_restitutionThreshold
 
b2Shapem_shape
 
b2FixtureUserData m_userData
 

Friends

class b2Body
 
class b2Contact
 
class b2ContactManager
 
class b2World
 

Detailed Description

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 friction, collision filters, etc. Fixtures are created via b2Body::CreateFixture.

Warning
you cannot reuse fixtures.

Definition at line 116 of file b2_fixture.h.

Constructor & Destructor Documentation

◆ b2Fixture()

b2Fixture::b2Fixture ( )
protected

Definition at line 34 of file b2_fixture.cpp.

Member Function Documentation

◆ Create()

void b2Fixture::Create ( b2BlockAllocator allocator,
b2Body body,
const b2FixtureDef def 
)
protected

Definition at line 44 of file b2_fixture.cpp.

◆ CreateProxies()

void b2Fixture::CreateProxies ( b2BroadPhase broadPhase,
const b2Transform xf 
)
protected

Definition at line 126 of file b2_fixture.cpp.

◆ Destroy()

void b2Fixture::Destroy ( b2BlockAllocator allocator)
protected

Definition at line 73 of file b2_fixture.cpp.

◆ DestroyProxies()

void b2Fixture::DestroyProxies ( b2BroadPhase broadPhase)
protected

Definition at line 143 of file b2_fixture.cpp.

◆ Dump()

void b2Fixture::Dump ( int32  bodyIndex)

Dump this fixture to the log file.

Definition at line 233 of file b2_fixture.cpp.

◆ GetAABB()

const b2AABB & b2Fixture::GetAABB ( int32  childIndex) const
inline

Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a more accurate AABB, compute it using the shape and the body transform.

Definition at line 359 of file b2_fixture.h.

◆ GetBody() [1/2]

b2Body * b2Fixture::GetBody ( )
inline

Get the parent body of this fixture. This is nullptr if the fixture is not attached.

Returns
the parent body.

Definition at line 283 of file b2_fixture.h.

◆ GetBody() [2/2]

const b2Body * b2Fixture::GetBody ( ) const
inline

Definition at line 288 of file b2_fixture.h.

◆ GetDensity()

float b2Fixture::GetDensity ( ) const
inline

Get the density of this fixture.

Definition at line 309 of file b2_fixture.h.

◆ GetFilterData()

const b2Filter & b2Fixture::GetFilterData ( ) const
inline

Get the contact filtering data.

Definition at line 273 of file b2_fixture.h.

◆ GetFriction()

float b2Fixture::GetFriction ( ) const
inline

Get the coefficient of friction.

Definition at line 314 of file b2_fixture.h.

◆ GetMassData()

void b2Fixture::GetMassData ( b2MassData massData) const
inline

Get the mass data for this fixture. The mass data is based on the density and the shape. The rotational inertia is about the shape's origin. This operation may be expensive.

Definition at line 354 of file b2_fixture.h.

◆ GetNext() [1/2]

b2Fixture * b2Fixture::GetNext ( )
inline

Get the next fixture in the parent body's fixture list.

Returns
the next shape.

Definition at line 293 of file b2_fixture.h.

◆ GetNext() [2/2]

const b2Fixture * b2Fixture::GetNext ( ) const
inline

Definition at line 298 of file b2_fixture.h.

◆ GetRestitution()

float b2Fixture::GetRestitution ( ) const
inline

Get the coefficient of restitution.

Definition at line 324 of file b2_fixture.h.

◆ GetRestitutionThreshold()

float b2Fixture::GetRestitutionThreshold ( ) const
inline

Get the restitution velocity threshold.

Definition at line 334 of file b2_fixture.h.

◆ GetShape() [1/2]

b2Shape * b2Fixture::GetShape ( )
inline

Get the child shape. You can modify the child shape, however you should not change the number of vertices because this will crash some collision caching mechanisms. Manipulating the shape may lead to non-physical behavior.

Definition at line 258 of file b2_fixture.h.

◆ GetShape() [2/2]

const b2Shape * b2Fixture::GetShape ( ) const
inline

Definition at line 263 of file b2_fixture.h.

◆ GetType()

b2Shape::Type b2Fixture::GetType ( ) const
inline

Get the type of the child shape. You can use this to down cast to the concrete shape.

Returns
the shape type.

Definition at line 253 of file b2_fixture.h.

◆ GetUserData()

b2FixtureUserData & b2Fixture::GetUserData ( )
inline

Get the user data that was assigned in the fixture definition. Use this to store your application specific data.

Definition at line 278 of file b2_fixture.h.

◆ IsSensor()

bool b2Fixture::IsSensor ( ) const
inline

Is this fixture a sensor (non-solid)?

Returns
the true if the shape is a sensor.

Definition at line 268 of file b2_fixture.h.

◆ RayCast()

bool b2Fixture::RayCast ( b2RayCastOutput output,
const b2RayCastInput input,
int32  childIndex 
) const
inline

Cast a ray against this shape.

Parameters
outputthe ray-cast results.
inputthe ray-cast input parameters.
childIndexthe child shape index (e.g. edge index)

Definition at line 349 of file b2_fixture.h.

◆ Refilter()

void b2Fixture::Refilter ( )

Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide.

Definition at line 187 of file b2_fixture.cpp.

◆ SetDensity()

void b2Fixture::SetDensity ( float  density)
inline

Set the density of this fixture. This will not automatically adjust the mass of the body. You must call b2Body::ResetMassData to update the body's mass.

Definition at line 303 of file b2_fixture.h.

◆ SetFilterData()

void b2Fixture::SetFilterData ( const b2Filter filter)

Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and awake. This automatically calls Refilter.

Definition at line 180 of file b2_fixture.cpp.

◆ SetFriction()

void b2Fixture::SetFriction ( float  friction)
inline

Set the coefficient of friction. This will not change the friction of existing contacts.

Definition at line 319 of file b2_fixture.h.

◆ SetRestitution()

void b2Fixture::SetRestitution ( float  restitution)
inline

Set the coefficient of restitution. This will not change the restitution of existing contacts.

Definition at line 329 of file b2_fixture.h.

◆ SetRestitutionThreshold()

void b2Fixture::SetRestitutionThreshold ( float  threshold)
inline

Set the restitution threshold. This will not change the restitution threshold of existing contacts.

Definition at line 339 of file b2_fixture.h.

◆ SetSensor()

void b2Fixture::SetSensor ( bool  sensor)

Set if this fixture is a sensor.

Definition at line 224 of file b2_fixture.cpp.

◆ Synchronize()

void b2Fixture::Synchronize ( b2BroadPhase broadPhase,
const b2Transform xf1,
const b2Transform xf2 
)
protected

Definition at line 156 of file b2_fixture.cpp.

◆ TestPoint()

bool b2Fixture::TestPoint ( const b2Vec2 p) const
inline

Test a point for containment in this fixture.

Parameters
pa point in world coordinates.

Definition at line 344 of file b2_fixture.h.

Friends And Related Function Documentation

◆ b2Body

friend class b2Body
friend

Definition at line 214 of file b2_fixture.h.

◆ b2Contact

friend class b2Contact
friend

Definition at line 216 of file b2_fixture.h.

◆ b2ContactManager

friend class b2ContactManager
friend

Definition at line 217 of file b2_fixture.h.

◆ b2World

friend class b2World
friend

Definition at line 215 of file b2_fixture.h.

Member Data Documentation

◆ m_body

b2Body* b2Fixture::m_body
protected

Definition at line 235 of file b2_fixture.h.

◆ m_density

float b2Fixture::m_density
protected

Definition at line 232 of file b2_fixture.h.

◆ m_filter

b2Filter b2Fixture::m_filter
protected

Definition at line 246 of file b2_fixture.h.

◆ m_friction

float b2Fixture::m_friction
protected

Definition at line 239 of file b2_fixture.h.

◆ m_isSensor

bool b2Fixture::m_isSensor
protected

Definition at line 248 of file b2_fixture.h.

◆ m_next

b2Fixture* b2Fixture::m_next
protected

Definition at line 234 of file b2_fixture.h.

◆ m_proxies

b2FixtureProxy* b2Fixture::m_proxies
protected

Definition at line 243 of file b2_fixture.h.

◆ m_proxyCount

int32 b2Fixture::m_proxyCount
protected

Definition at line 244 of file b2_fixture.h.

◆ m_restitution

float b2Fixture::m_restitution
protected

Definition at line 240 of file b2_fixture.h.

◆ m_restitutionThreshold

float b2Fixture::m_restitutionThreshold
protected

Definition at line 241 of file b2_fixture.h.

◆ m_shape

b2Shape* b2Fixture::m_shape
protected

Definition at line 237 of file b2_fixture.h.

◆ m_userData

b2FixtureUserData b2Fixture::m_userData
protected

Definition at line 250 of file b2_fixture.h.


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


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:22