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() [1/2]
Internal: wraps a Box2D fixture (use Body::new*Fixture).
在文件 Fixture.cpp 第 9 行定义.
◆ ~Fixture()
| eve::physics::Fixture::~Fixture | ( | ) |
在文件 Fixture.cpp 第 12 行定义.
引用了 eve::physics::World::forgetFixture() , 以及 eve::physics::Body::raw().
◆ Fixture() [2/2]
|
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()
|
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.
◆ 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()
|
inline |
◆ invalidate()
| void eve::physics::Fixture::invalidate | ( | ) |
◆ isSensor()
| bool eve::physics::Fixture::isSensor | ( | ) | const |
True when sensor.
在文件 Fixture.cpp 第 48 行定义.
◆ operator=()
◆ raw() [1/2]
|
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.
被这些函数引用 eve::physics::World::forgetFixture().
◆ raw() [2/2]
|
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.
◆ setCategoryBits()
| void eve::physics::Fixture::setCategoryBits | ( | int | bits | ) |
◆ setDensity()
| void eve::physics::Fixture::setDensity | ( | float | density | ) |
◆ setFriction()
| void eve::physics::Fixture::setFriction | ( | float | friction | ) |
Material properties.
在文件 Fixture.cpp 第 50 行定义.
◆ setGroupIndex()
| void eve::physics::Fixture::setGroupIndex | ( | int | index | ) |
◆ setMaskBits()
| void eve::physics::Fixture::setMaskBits | ( | int | bits | ) |
◆ setRestitution()
| void eve::physics::Fixture::setRestitution | ( | float | restitution | ) |
◆ setSensor()
| void eve::physics::Fixture::setSensor | ( | bool | sensor | ) |
Sensor fixtures report contacts but never collide.
在文件 Fixture.cpp 第 43 行定义.
◆ setTag()
|
inline |
◆ 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
◆ World
◆ WorldSnapshotAccess
|
friend |
该类的文档由以下文件生成:
- src/modules/physics/Fixture.h
- src/modules/physics/Fixture.cpp