3D rigid body (Box3D) in meter-space coordinates (+Y up by convention). Owned by a World3D; create shapes with newBoxShape/newSphereShape/newCapsuleShape. 更多...
#include <Body3D.h>
Public 成员函数 | |
| Body3D (World3D *world, b3BodyId bodyId, int id) | |
| Internal: wraps a Box3D body (use World3D::newBody). | |
| ~Body3D () | |
| Body3D (const Body3D &)=delete | |
| Body3D & | operator= (const Body3D &)=delete |
| int | getId () const |
| Stable id used by collision events. | |
| void | setPosition (float x, float y, float z) |
| Position in meters. | |
| float | getX () const |
| float | getY () const |
| float | getZ () const |
| void | setRotation (float qx, float qy, float qz, float qw) |
| Orientation as quaternion (x, y, z, w). | |
| float | getRotX () const |
| float | getRotY () const |
| float | getRotZ () const |
| float | getRotW () const |
| void | setLinearVelocity (float vx, float vy, float vz) |
| Linear velocity in m/s. | |
| float | getLinearVelocityX () const |
| float | getLinearVelocityY () const |
| float | getLinearVelocityZ () const |
| void | setAngularVelocity (float wx, float wy, float wz) |
| Angular velocity in rad/s. | |
| float | getAngularVelocityX () const |
| float | getAngularVelocityY () const |
| float | getAngularVelocityZ () const |
| void | applyForce (float fx, float fy, float fz) |
| Force applied at the center of mass. | |
| void | applyForceAt (float fx, float fy, float fz, float x, float y, float z) |
| Force applied at a world position. | |
| void | applyLinearImpulse (float ix, float iy, float iz) |
| Instantaneous linear impulse. | |
| void | applyAngularImpulse (float ix, float iy, float iz) |
| Instantaneous angular impulse. | |
| void | setType (const std::string &bodyType) |
| "static" | "kinematic" | "dynamic". | |
| std::string | getType () const |
| void | setFixedRotation (bool fixed) |
| Lock all angular axes (Box3D motion locks). | |
| bool | isFixedRotation () const |
| void | setActive (bool active) |
| Disables/enables the body and its shapes. | |
| bool | isActive () const |
| void | setBullet (bool bullet) |
| CCD bullet mode. | |
| bool | isBullet () const |
| void | setAwake (bool awake) |
| Wakes / sleeps the body manually. | |
| bool | isAwake () const |
| Shape3D * | newBoxShape (float width, float height, float depth, float density=1.f, float friction=0.2f, float restitution=0.f) |
| Box extents are full width/height/depth in meters (same convention as Body.newRectangleFixture). Density kg/m³. | |
| Shape3D * | newSphereShape (float radius, float density=1.f, float friction=0.2f, float restitution=0.f) |
| Shape3D * | newCapsuleShape (float height, float radius, float density=1.f, float friction=0.2f, float restitution=0.f) |
| Capsule along local Y; height is distance between hemisphere centers. | |
| void | destroy () |
| Destroys the body inside its world. | |
| World3D * | getWorld () |
| Owning world / raw Box3D body id. | |
| b3BodyId | raw () const |
| bool | isValid () const |
| True while the underlying Box3D body is still alive. | |
| void | invalidate () |
| Internal: marks the wrapper invalid after world destruction. | |
友元 | |
| class | World3D |
| class | Shape3D |
详细描述
3D rigid body (Box3D) in meter-space coordinates (+Y up by convention). Owned by a World3D; create shapes with newBoxShape/newSphereShape/newCapsuleShape.
构造及析构函数说明
◆ Body3D() [1/2]
| eve::physics::Body3D::Body3D | ( | World3D * | world, |
| b3BodyId | bodyId, | ||
| int | id | ||
| ) |
Internal: wraps a Box3D body (use World3D::newBody).
在文件 Body3D.cpp 第 43 行定义.
◆ ~Body3D()
| eve::physics::Body3D::~Body3D | ( | ) |
◆ Body3D() [2/2]
|
delete |
成员函数说明
◆ applyAngularImpulse()
| void eve::physics::Body3D::applyAngularImpulse | ( | float | ix, |
| float | iy, | ||
| float | iz | ||
| ) |
◆ applyForce()
| void eve::physics::Body3D::applyForce | ( | float | fx, |
| float | fy, | ||
| float | fz | ||
| ) |
◆ applyForceAt()
| void eve::physics::Body3D::applyForceAt | ( | float | fx, |
| float | fy, | ||
| float | fz, | ||
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
◆ applyLinearImpulse()
| void eve::physics::Body3D::applyLinearImpulse | ( | float | ix, |
| float | iy, | ||
| float | iz | ||
| ) |
◆ destroy()
| void eve::physics::Body3D::destroy | ( | ) |
Destroys the body inside its world.
在文件 Body3D.cpp 第 72 行定义.
引用了 eve::physics::World3D::forgetBody(), eve::physics::World3D::forgetShape(), invalidate(), isValid(), eve::physics::World3D::isValid() , 以及 s.
◆ getAngularVelocityX()
| float eve::physics::Body3D::getAngularVelocityX | ( | ) | const |
在文件 Body3D.cpp 第 175 行定义.
引用了 isValid().
◆ getAngularVelocityY()
| float eve::physics::Body3D::getAngularVelocityY | ( | ) | const |
在文件 Body3D.cpp 第 180 行定义.
引用了 isValid().
◆ getAngularVelocityZ()
| float eve::physics::Body3D::getAngularVelocityZ | ( | ) | const |
在文件 Body3D.cpp 第 185 行定义.
引用了 isValid().
◆ getId()
|
inline |
◆ getLinearVelocityX()
| float eve::physics::Body3D::getLinearVelocityX | ( | ) | const |
在文件 Body3D.cpp 第 155 行定义.
引用了 isValid().
◆ getLinearVelocityY()
| float eve::physics::Body3D::getLinearVelocityY | ( | ) | const |
在文件 Body3D.cpp 第 160 行定义.
引用了 isValid().
◆ getLinearVelocityZ()
| float eve::physics::Body3D::getLinearVelocityZ | ( | ) | const |
在文件 Body3D.cpp 第 165 行定义.
引用了 isValid().
◆ getRotW()
| float eve::physics::Body3D::getRotW | ( | ) | const |
在文件 Body3D.cpp 第 145 行定义.
引用了 isValid().
◆ getRotX()
| float eve::physics::Body3D::getRotX | ( | ) | const |
在文件 Body3D.cpp 第 130 行定义.
引用了 isValid().
◆ getRotY()
| float eve::physics::Body3D::getRotY | ( | ) | const |
在文件 Body3D.cpp 第 135 行定义.
引用了 isValid().
◆ getRotZ()
| float eve::physics::Body3D::getRotZ | ( | ) | const |
在文件 Body3D.cpp 第 140 行定义.
引用了 isValid().
◆ getType()
| std::string eve::physics::Body3D::getType | ( | ) | const |
在文件 Body3D.cpp 第 215 行定义.
引用了 isValid().
◆ getWorld()
|
inline |
◆ getX()
| float eve::physics::Body3D::getX | ( | ) | const |
在文件 Body3D.cpp 第 98 行定义.
引用了 isValid().
◆ getY()
| float eve::physics::Body3D::getY | ( | ) | const |
在文件 Body3D.cpp 第 103 行定义.
引用了 isValid().
◆ getZ()
| float eve::physics::Body3D::getZ | ( | ) | const |
在文件 Body3D.cpp 第 108 行定义.
引用了 isValid().
◆ invalidate()
| void eve::physics::Body3D::invalidate | ( | ) |
Internal: marks the wrapper invalid after world destruction.
在文件 Body3D.cpp 第 66 行定义.
引用了 isValid().
被这些函数引用 destroy().
◆ isActive()
| bool eve::physics::Body3D::isActive | ( | ) | const |
在文件 Body3D.cpp 第 243 行定义.
引用了 isValid().
◆ isAwake()
| bool eve::physics::Body3D::isAwake | ( | ) | const |
在文件 Body3D.cpp 第 257 行定义.
引用了 isValid().
◆ isBullet()
| bool eve::physics::Body3D::isBullet | ( | ) | const |
在文件 Body3D.cpp 第 250 行定义.
引用了 isValid().
◆ isFixedRotation()
| bool eve::physics::Body3D::isFixedRotation | ( | ) | const |
在文件 Body3D.cpp 第 229 行定义.
引用了 isValid().
◆ isValid()
| bool eve::physics::Body3D::isValid | ( | ) | const |
True while the underlying Box3D body is still alive.
在文件 Body3D.cpp 第 64 行定义.
被这些函数引用 applyAngularImpulse(), applyForce(), applyForceAt(), applyLinearImpulse(), destroy(), eve::physics::Shape3D::destroy(), getAngularVelocityX(), getAngularVelocityY(), getAngularVelocityZ(), getLinearVelocityX(), getLinearVelocityY(), getLinearVelocityZ(), getRotW(), getRotX(), getRotY(), getRotZ(), getType(), getX(), getY(), getZ(), invalidate(), isActive(), isAwake(), isBullet(), isFixedRotation(), newBoxShape(), newCapsuleShape(), newSphereShape(), setActive(), setAngularVelocity(), setAwake(), setBullet(), setFixedRotation(), setLinearVelocity(), setPosition(), setRotation(), eve::physics::Shape3D::setSensor(), setType(), eve::physics::Shape3D::testPoint(), ~Body3D() , 以及 eve::physics::Shape3D::~Shape3D().
◆ newBoxShape()
| Shape3D * eve::physics::Body3D::newBoxShape | ( | float | width, |
| float | height, | ||
| float | depth, | ||
| float | density = 1.f, |
||
| float | friction = 0.2f, |
||
| float | restitution = 0.f |
||
| ) |
Box extents are full width/height/depth in meters (same convention as Body.newRectangleFixture). Density kg/m³.
在文件 Body3D.cpp 第 259 行定义.
引用了 eve::physics::Shape3D::Box, depth, height, isValid(), Shape3D , 以及 width.
◆ newCapsuleShape()
| Shape3D * eve::physics::Body3D::newCapsuleShape | ( | float | height, |
| float | radius, | ||
| float | density = 1.f, |
||
| float | friction = 0.2f, |
||
| float | restitution = 0.f |
||
| ) |
Capsule along local Y; height is distance between hemisphere centers.
在文件 Body3D.cpp 第 296 行定义.
引用了 eve::physics::Shape3D::Capsule, height, isValid() , 以及 Shape3D.
◆ newSphereShape()
| Shape3D * eve::physics::Body3D::newSphereShape | ( | float | radius, |
| float | density = 1.f, |
||
| float | friction = 0.2f, |
||
| float | restitution = 0.f |
||
| ) |
在文件 Body3D.cpp 第 279 行定义.
引用了 isValid(), Shape3D , 以及 eve::physics::Shape3D::Sphere.
◆ operator=()
◆ raw()
|
inline |
被这些函数引用 eve::physics::Shape3D::testPoint().
◆ setActive()
| void eve::physics::Body3D::setActive | ( | bool | active | ) |
◆ setAngularVelocity()
| void eve::physics::Body3D::setAngularVelocity | ( | float | wx, |
| float | wy, | ||
| float | wz | ||
| ) |
◆ setAwake()
| void eve::physics::Body3D::setAwake | ( | bool | awake | ) |
◆ setBullet()
| void eve::physics::Body3D::setBullet | ( | bool | bullet | ) |
◆ setFixedRotation()
| void eve::physics::Body3D::setFixedRotation | ( | bool | fixed | ) |
◆ setLinearVelocity()
| void eve::physics::Body3D::setLinearVelocity | ( | float | vx, |
| float | vy, | ||
| float | vz | ||
| ) |
◆ setPosition()
| void eve::physics::Body3D::setPosition | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
◆ setRotation()
| void eve::physics::Body3D::setRotation | ( | float | qx, |
| float | qy, | ||
| float | qz, | ||
| float | qw | ||
| ) |
◆ setType()
| void eve::physics::Body3D::setType | ( | const std::string & | bodyType | ) |
友元及相关函数文档
◆ Shape3D
|
friend |
被这些函数引用 newBoxShape(), newCapsuleShape() , 以及 newSphereShape().
◆ World3D
该类的文档由以下文件生成:
- src/modules/physics/Body3D.h
- src/modules/physics/Body3D.cpp