载入中...
搜索中...
未找到
eve::physics::Fixture类 参考

2D fixture: a shape attached to a Body with material + filter settings. Also carries a string tag used by contact events. 更多...

#include <Fixture.h>

Public 成员函数

 Fixture (World *world, Body *body, b2Fixture *fixture)
 Internal: wraps a Box2D fixture (use Body::new*Fixture).
 
 ~Fixture ()
 Fixture.
 
 Fixture (const Fixture &)=delete
 
Fixture & operator= (const Fixture &)=delete
 
void setSensor (bool sensor)
 Sensor fixtures report contacts but never collide.
 
bool isSensor () const
 True when sensor.
 
void setFriction (float friction)
 Material properties.
 
float getFriction () const
 Returns the friction.
 
void setRestitution (float restitution)
 Sets the restitution.
 
float getRestitution () const
 Returns the restitution.
 
void setDensity (float density)
 Sets the density.
 
float getDensity () const
 Returns the density.
 
void setTag (const std::string &tag)
 Arbitrary string tag surfaced in begin/end contact events.
 
const std::string & getTag () const
 Returns the tag.
 
void setCategoryBits (int bits)
 Collision filtering (Box2D category/mask bits, group index).
 
int getCategoryBits () const
 Returns the category bits.
 
void setMaskBits (int bits)
 Sets the mask bits.
 
int getMaskBits () const
 Returns the mask bits.
 
void setGroupIndex (int index)
 Sets the group index.
 
int getGroupIndex () const
 Returns the group index.
 
int getBodyId () const
 Id of the owning body.
 
Body * getBody ()
 Returns the owning body, or null after invalidation.
 
bool testPoint (float x, float y) const
 Pixel-space point-in-fixture test (uses World meter).
 
void destroy ()
 Destroys the fixture inside its world.
 
b2Fixture * raw ()
 Exposes the underlying Box2D fixture for tightly-scoped backend integration.
 
const b2Fixture * raw () const
 Exposes the underlying Box2D fixture for read-only backend integration.
 
void invalidate ()
 Internal: marks the wrapper invalid after destruction.
 

友元

struct WorldSnapshotAccess
 
class World
 
class Body
 

详细描述

2D fixture: a shape attached to a Body with material + filter settings. Also carries a string tag used by contact events.

在文件 Fixture.h 第 18 行定义.

构造及析构函数说明

◆ Fixture() [1/2]

eve::physics::Fixture::Fixture ( World *  world,
Body *  body,
b2Fixture *  fixture 
)

Internal: wraps a Box2D fixture (use Body::new*Fixture).

在文件 Fixture.cpp 第 9 行定义.

◆ ~Fixture()

eve::physics::Fixture::~Fixture ( )

◆ Fixture() [2/2]

eve::physics::Fixture::Fixture ( const Fixture &  )
delete

成员函数说明

◆ destroy()

void eve::physics::Fixture::destroy ( )

Destroys the fixture inside its world.

在文件 Fixture.cpp 第 30 行定义.

引用了 eve::physics::World::forgetFixture(), invalidate() , 以及 eve::physics::Body::raw().

◆ getBody()

Body * eve::physics::Fixture::getBody ( )
inline

Returns the owning body, or null after invalidation.

返回
Borrowed nullable Body pointer owned by the physics world. @ownership Fixture does not own the body; callers must not delete it. @lifetime Valid until body/world destruction; use a PhysicsBodyHandle across frames. @thread Call on the owning physics thread. @reentrancy The accessor invokes no callbacks and is invalid across world mutation.

在文件 Fixture.h 第 77 行定义.

◆ getBodyId()

int eve::physics::Fixture::getBodyId ( ) const

Id of the owning body.

在文件 Fixture.cpp 第 103 行定义.

引用了 eve::physics::Body::getId().

被这些函数引用 eve::physics::World::forgetFixture().

◆ getCategoryBits()

int eve::physics::Fixture::getCategoryBits ( ) const

Returns the category bits.

在文件 Fixture.cpp 第 79 行定义.

◆ getDensity()

float eve::physics::Fixture::getDensity ( ) const

Returns the density.

在文件 Fixture.cpp 第 70 行定义.

◆ getFriction()

float eve::physics::Fixture::getFriction ( ) const

Returns the friction.

在文件 Fixture.cpp 第 55 行定义.

◆ getGroupIndex()

int eve::physics::Fixture::getGroupIndex ( ) const

Returns the group index.

在文件 Fixture.cpp 第 99 行定义.

◆ getMaskBits()

int eve::physics::Fixture::getMaskBits ( ) const

Returns the mask bits.

在文件 Fixture.cpp 第 90 行定义.

◆ getRestitution()

float eve::physics::Fixture::getRestitution ( ) const

Returns the restitution.

在文件 Fixture.cpp 第 62 行定义.

◆ getTag()

const std::string & eve::physics::Fixture::getTag ( ) const
inline

Returns the tag.

在文件 Fixture.h 第 51 行定义.

被这些函数引用 eve::physics::World::forgetFixture().

◆ invalidate()

void eve::physics::Fixture::invalidate ( )

Internal: marks the wrapper invalid after destruction.

在文件 Fixture.cpp 第 23 行定义.

被这些函数引用 destroy().

◆ isSensor()

bool eve::physics::Fixture::isSensor ( ) const

True when sensor.

在文件 Fixture.cpp 第 48 行定义.

◆ operator=()

Fixture & eve::physics::Fixture::operator= ( const Fixture &  )
delete

◆ raw() [1/2]

b2Fixture * eve::physics::Fixture::raw ( )
inline

Exposes the underlying Box2D fixture for tightly-scoped backend integration.

返回
Borrowed nullable backend pointer; callers must not delete or retain it across steps. @ownership The Box2D world owns the fixture; Fixture is only its wrapper. @lifetime Valid until Fixture::destroy(), body/world destruction, or invalidate(). @thread Call only on the owning physics thread. @reentrancy Does not invoke callbacks and is invalid across world mutation.

在文件 Fixture.h 第 93 行定义.

被这些函数引用 eve::physics::World::forgetFixture().

◆ raw() [2/2]

const b2Fixture * eve::physics::Fixture::raw ( ) const
inline

Exposes the underlying Box2D fixture for read-only backend integration.

返回
Borrowed nullable backend pointer. @ownership The Box2D world owns the fixture; callers must not delete it. @lifetime Valid until Fixture::destroy(), body/world destruction, or invalidate(). @thread Call only on the owning physics thread. @reentrancy Does not invoke callbacks and is invalid across world mutation.

在文件 Fixture.h 第 102 行定义.

◆ setCategoryBits()

void eve::physics::Fixture::setCategoryBits ( int  bits)

Collision filtering (Box2D category/mask bits, group index).

在文件 Fixture.cpp 第 72 行定义.

引用了 filter.

◆ setDensity()

void eve::physics::Fixture::setDensity ( float  density)

Sets the density.

在文件 Fixture.cpp 第 64 行定义.

引用了 eve::physics::Body::raw().

◆ setFriction()

void eve::physics::Fixture::setFriction ( float  friction)

Material properties.

在文件 Fixture.cpp 第 50 行定义.

◆ setGroupIndex()

void eve::physics::Fixture::setGroupIndex ( int  index)

Sets the group index.

在文件 Fixture.cpp 第 92 行定义.

引用了 filter , 以及 index.

◆ setMaskBits()

void eve::physics::Fixture::setMaskBits ( int  bits)

Sets the mask bits.

在文件 Fixture.cpp 第 83 行定义.

引用了 filter.

◆ setRestitution()

void eve::physics::Fixture::setRestitution ( float  restitution)

Sets the restitution.

在文件 Fixture.cpp 第 57 行定义.

引用了 restitution.

◆ setSensor()

void eve::physics::Fixture::setSensor ( bool  sensor)

Sensor fixtures report contacts but never collide.

在文件 Fixture.cpp 第 43 行定义.

◆ setTag()

void eve::physics::Fixture::setTag ( const std::string &  tag)
inline

Arbitrary string tag surfaced in begin/end contact events.

在文件 Fixture.h 第 49 行定义.

引用了 tag.

◆ testPoint()

bool eve::physics::Fixture::testPoint ( float  x,
float  y 
) const

Pixel-space point-in-fixture test (uses World meter).

在文件 Fixture.cpp 第 105 行定义.

引用了 eve::physics::World::toMeters(), x , 以及 y.

友元及相关函数文档

◆ Body

friend class Body
friend

在文件 Fixture.h 第 110 行定义.

◆ World

friend class World
friend

在文件 Fixture.h 第 109 行定义.

◆ WorldSnapshotAccess

friend struct WorldSnapshotAccess
friend

在文件 Fixture.h 第 108 行定义.


该类的文档由以下文件生成: