Script-facing Box2D joint owned by a World. 更多...
#include <Joint2D.h>
Public 类型 | |
| enum class | Kind { Distance , Revolute , Prismatic , Weld , Wheel , Motor , Gear } |
| Supported joint geometry. 更多... | |
Public 成员函数 | |
| Joint2D (World *world, Body *bodyA, Body *bodyB, b2Joint *joint, PhysicsJointHandle runtimeHandle, Kind kind, int id) | |
| Internal wrapper constructor; use World::new*Joint. | |
| ~Joint2D () | |
| Joint2D (const Joint2D &)=delete | |
| Joint2D & | operator= (const Joint2D &)=delete |
| int | getId () const |
| Stable world-local identifier. | |
| PhysicsJointHandle | runtimeHandle () const |
| Process-local generation-qualified handle owned by World. | |
| std::string | getKind () const |
| Joint kind string for script/debug. | |
| int | getBodyAId () const |
| Stable ID of attached body A, or -1 after invalidation. | |
| int | getBodyBId () const |
| Stable ID of attached body B, or -1 after invalidation. | |
| World * | getWorld () const |
| Owning world, or null after joint destruction. | |
| void | setCollideConnected (bool collide) |
| Enables or disables collision between the attached bodies. | |
| bool | getCollideConnected () const |
| Whether attached bodies may collide. | |
| void | setDistanceLength (float lengthPixels) |
| Changes distance-joint rest length in pixels. | |
| float | getDistanceLength () const |
| Distance-joint rest length in pixels. | |
| void | setDistanceSpring (float frequencyHz, float dampingRatio) |
| Configures distance spring frequency (Hz) and damping ratio. | |
| float | getDistanceFrequency () const |
| Distance spring frequency in Hertz. | |
| float | getDistanceDampingRatio () const |
| Distance spring damping ratio. | |
| void | setRevoluteLimits (bool enabled, float lower, float upper) |
| Configures revolute angular limits in radians. | |
| void | setRevoluteMotor (bool enabled, float speed, float maxTorque) |
| Configures the revolute motor in radians/second and newton-metres. | |
| float | getRevoluteAngle () const |
| Current revolute angle in radians. | |
| float | getRevoluteSpeed () const |
| Current revolute speed in radians/second. | |
| float | getRevoluteMotorTorque () const |
| Current revolute motor torque in newton-metres. | |
| void | setPrismaticLimits (bool enabled, float lowerPixels, float upperPixels) |
| Configures prismatic translation limits in pixels. | |
| void | setPrismaticMotor (bool enabled, float speedPixels, float maxForcePixels) |
| Configures a prismatic motor in pixels/second and pixel-force units. | |
| float | getPrismaticTranslation () const |
| Current prismatic translation in pixels. | |
| float | getPrismaticSpeed () const |
| Current prismatic speed in pixels/second. | |
| void | setWeldSpring (float frequencyHz, float dampingRatio) |
| Configures weld rotational spring frequency and damping. | |
| float | getWeldFrequency () const |
| Weld spring frequency in Hertz. | |
| float | getWeldDampingRatio () const |
| Weld spring damping ratio. | |
| void | setWheelSpring (float frequencyHz, float dampingRatio) |
| Configures wheel suspension spring. | |
| void | setWheelMotor (bool enabled, float speed, float maxTorque) |
| Configures wheel spin motor in radians/second and newton-metres. | |
| float | getWheelTranslation () const |
| Current wheel translation along the suspension axis in pixels. | |
| float | getWheelSpeed () const |
| Current wheel spin speed in radians/second. | |
| void | setMotorLinearOffset (float xPixels, float yPixels) |
| Sets motor-joint linear offset in pixels (bodyA frame). | |
| void | setMotorAngularOffset (float radians) |
| Sets motor-joint angular offset in radians. | |
| void | setMotorLimits (float maxForcePixels, float maxTorque) |
| Sets motor max force (pixel-force) and torque (N·m). | |
| float | getMotorLinearOffsetX () const |
| Motor linear offset X in pixels. | |
| float | getMotorLinearOffsetY () const |
| Motor linear offset Y in pixels. | |
| float | getMotorAngularOffset () const |
| Motor angular offset in radians. | |
| void | setGearRatio (float ratio) |
| Changes gear ratio. | |
| float | getGearRatio () const |
| Current gear ratio. | |
| Joint2D * | getGearJoint1 () const |
| First joint linked by a gear, or null. | |
| Joint2D * | getGearJoint2 () const |
| Second joint linked by a gear, or null. | |
| void | destroy () |
| Destroys the backend joint and invalidates this wrapper. | |
| bool | isValid () const |
| Whether the backend joint still exists. | |
| void | invalidate () |
| Internal invalidation used by body/world destruction. | |
| b2Joint * | raw () const |
| Internal raw Box2D joint. | |
友元 | |
| class | Body |
| class | World |
| class | Mechanism2D |
详细描述
Script-facing Box2D joint owned by a World.
Anchors, lengths and linear motor quantities use pixel space (same as Body). Angles and angular motors use radians.
成员枚举类型说明
◆ Kind
|
strong |
构造及析构函数说明
◆ Joint2D() [1/2]
| eve::physics::Joint2D::Joint2D | ( | World * | world, |
| Body * | bodyA, | ||
| Body * | bodyB, | ||
| b2Joint * | joint, | ||
| PhysicsJointHandle | runtimeHandle, | ||
| Kind | kind, | ||
| int | id | ||
| ) |
Internal wrapper constructor; use World::new*Joint.
在文件 Joint2D.cpp 第 26 行定义.
◆ ~Joint2D()
| eve::physics::Joint2D::~Joint2D | ( | ) |
在文件 Joint2D.cpp 第 36 行定义.
引用了 destroy().
◆ Joint2D() [2/2]
|
delete |
成员函数说明
◆ destroy()
| void eve::physics::Joint2D::destroy | ( | ) |
Destroys the backend joint and invalidates this wrapper.
在文件 Joint2D.cpp 第 51 行定义.
引用了 eve::physics::World::forgetJoint(), Gear, invalidate(), isValid() , 以及 eve::physics::World::raw().
被这些函数引用 ~Joint2D().
◆ getBodyAId()
| int eve::physics::Joint2D::getBodyAId | ( | ) | const |
Stable ID of attached body A, or -1 after invalidation.
在文件 Joint2D.cpp 第 89 行定义.
引用了 eve::physics::Body::getId().
被这些函数引用 eve::physics::World::newGearJoint().
◆ getBodyBId()
| int eve::physics::Joint2D::getBodyBId | ( | ) | const |
Stable ID of attached body B, or -1 after invalidation.
在文件 Joint2D.cpp 第 90 行定义.
引用了 eve::physics::Body::getId().
被这些函数引用 eve::physics::World::newGearJoint().
◆ getCollideConnected()
| bool eve::physics::Joint2D::getCollideConnected | ( | ) | const |
◆ getDistanceDampingRatio()
| float eve::physics::Joint2D::getDistanceDampingRatio | ( | ) | const |
◆ getDistanceFrequency()
| float eve::physics::Joint2D::getDistanceFrequency | ( | ) | const |
◆ getDistanceLength()
| float eve::physics::Joint2D::getDistanceLength | ( | ) | const |
Distance-joint rest length in pixels.
在文件 Joint2D.cpp 第 115 行定义.
引用了 Distance , 以及 eve::physics::World::toPixels().
◆ getGearJoint1()
|
inline |
◆ getGearJoint2()
|
inline |
◆ getGearRatio()
| float eve::physics::Joint2D::getGearRatio | ( | ) | const |
◆ getId()
|
inline |
◆ getKind()
| std::string eve::physics::Joint2D::getKind | ( | ) | const |
Joint kind string for script/debug.
在文件 Joint2D.cpp 第 76 行定义.
引用了 Distance, Gear, Motor, Prismatic, Revolute, Weld , 以及 Wheel.
被这些函数引用 eve::physics::World::newGearJoint().
◆ getMotorAngularOffset()
| float eve::physics::Joint2D::getMotorAngularOffset | ( | ) | const |
◆ getMotorLinearOffsetX()
| float eve::physics::Joint2D::getMotorLinearOffsetX | ( | ) | const |
Motor linear offset X in pixels.
在文件 Joint2D.cpp 第 259 行定义.
引用了 Motor, eve::physics::World::toPixels() , 以及 x.
◆ getMotorLinearOffsetY()
| float eve::physics::Joint2D::getMotorLinearOffsetY | ( | ) | const |
Motor linear offset Y in pixels.
在文件 Joint2D.cpp 第 263 行定义.
引用了 Motor, eve::physics::World::toPixels() , 以及 y.
◆ getPrismaticSpeed()
| float eve::physics::Joint2D::getPrismaticSpeed | ( | ) | const |
Current prismatic speed in pixels/second.
在文件 Joint2D.cpp 第 191 行定义.
引用了 Prismatic , 以及 eve::physics::World::toPixels().
◆ getPrismaticTranslation()
| float eve::physics::Joint2D::getPrismaticTranslation | ( | ) | const |
Current prismatic translation in pixels.
在文件 Joint2D.cpp 第 187 行定义.
引用了 Prismatic , 以及 eve::physics::World::toPixels().
◆ getRevoluteAngle()
| float eve::physics::Joint2D::getRevoluteAngle | ( | ) | const |
◆ getRevoluteMotorTorque()
| float eve::physics::Joint2D::getRevoluteMotorTorque | ( | ) | const |
◆ getRevoluteSpeed()
| float eve::physics::Joint2D::getRevoluteSpeed | ( | ) | const |
◆ getWeldDampingRatio()
| float eve::physics::Joint2D::getWeldDampingRatio | ( | ) | const |
◆ getWeldFrequency()
| float eve::physics::Joint2D::getWeldFrequency | ( | ) | const |
◆ getWheelSpeed()
| float eve::physics::Joint2D::getWheelSpeed | ( | ) | const |
◆ getWheelTranslation()
| float eve::physics::Joint2D::getWheelTranslation | ( | ) | const |
Current wheel translation along the suspension axis in pixels.
在文件 Joint2D.cpp 第 230 行定义.
引用了 eve::physics::World::toPixels() , 以及 Wheel.
◆ getWorld()
|
inline |
Owning world, or null after joint destruction.
- 返回
- Borrowed world pointer. @ownership World owns this joint; the returned world pointer is borrowed. @lifetime Valid until World::destroy() or this joint's invalidation.
被这些函数引用 eve::physics::World::newGearJoint().
◆ invalidate()
| void eve::physics::Joint2D::invalidate | ( | ) |
Internal invalidation used by body/world destruction.
在文件 Joint2D.cpp 第 40 行定义.
引用了 eve::physics::World::forgetJoint() , 以及 eve::RuntimeHandle< PhysicsJointHandleTag >::invalid().
被这些函数引用 destroy().
◆ isValid()
| bool eve::physics::Joint2D::isValid | ( | ) | const |
Whether the backend joint still exists.
在文件 Joint2D.cpp 第 38 行定义.
引用了 eve::physics::World::raw().
被这些函数引用 destroy(), getCollideConnected(), eve::physics::World::newGearJoint() , 以及 setCollideConnected().
◆ operator=()
◆ raw()
|
inline |
◆ runtimeHandle()
|
inline |
Process-local generation-qualified handle owned by World.
被这些函数引用 eve::physics::World::forgetJoint().
◆ setCollideConnected()
| void eve::physics::Joint2D::setCollideConnected | ( | bool | collide | ) |
◆ setDistanceLength()
| void eve::physics::Joint2D::setDistanceLength | ( | float | lengthPixels | ) |
Changes distance-joint rest length in pixels.
在文件 Joint2D.cpp 第 110 行定义.
引用了 Distance , 以及 eve::physics::World::toMeters().
◆ setDistanceSpring()
| void eve::physics::Joint2D::setDistanceSpring | ( | float | frequencyHz, |
| float | dampingRatio | ||
| ) |
Configures distance spring frequency (Hz) and damping ratio.
在文件 Joint2D.cpp 第 119 行定义.
◆ setGearRatio()
| void eve::physics::Joint2D::setGearRatio | ( | float | ratio | ) |
◆ setMotorAngularOffset()
| void eve::physics::Joint2D::setMotorAngularOffset | ( | float | radians | ) |
◆ setMotorLimits()
| void eve::physics::Joint2D::setMotorLimits | ( | float | maxForcePixels, |
| float | maxTorque | ||
| ) |
Sets motor max force (pixel-force) and torque (N·m).
在文件 Joint2D.cpp 第 251 行定义.
引用了 Motor , 以及 eve::physics::World::toMeters().
◆ setMotorLinearOffset()
| void eve::physics::Joint2D::setMotorLinearOffset | ( | float | xPixels, |
| float | yPixels | ||
| ) |
Sets motor-joint linear offset in pixels (bodyA frame).
在文件 Joint2D.cpp 第 239 行定义.
引用了 finite, Motor , 以及 eve::physics::World::toMeters().
◆ setPrismaticLimits()
| void eve::physics::Joint2D::setPrismaticLimits | ( | bool | enabled, |
| float | lowerPixels, | ||
| float | upperPixels | ||
| ) |
Configures prismatic translation limits in pixels.
在文件 Joint2D.cpp 第 168 行定义.
引用了 enabled, finite, Prismatic , 以及 eve::physics::World::toMeters().
◆ setPrismaticMotor()
| void eve::physics::Joint2D::setPrismaticMotor | ( | bool | enabled, |
| float | speedPixels, | ||
| float | maxForcePixels | ||
| ) |
Configures a prismatic motor in pixels/second and pixel-force units.
在文件 Joint2D.cpp 第 178 行定义.
引用了 enabled, finite, Prismatic , 以及 eve::physics::World::toMeters().
◆ setRevoluteLimits()
| void eve::physics::Joint2D::setRevoluteLimits | ( | bool | enabled, |
| float | lower, | ||
| float | upper | ||
| ) |
Configures revolute angular limits in radians.
在文件 Joint2D.cpp 第 136 行定义.
◆ setRevoluteMotor()
| void eve::physics::Joint2D::setRevoluteMotor | ( | bool | enabled, |
| float | speed, | ||
| float | maxTorque | ||
| ) |
Configures the revolute motor in radians/second and newton-metres.
在文件 Joint2D.cpp 第 146 行定义.
◆ setWeldSpring()
| void eve::physics::Joint2D::setWeldSpring | ( | float | frequencyHz, |
| float | dampingRatio | ||
| ) |
◆ setWheelMotor()
| void eve::physics::Joint2D::setWheelMotor | ( | bool | enabled, |
| float | speed, | ||
| float | maxTorque | ||
| ) |
Configures wheel spin motor in radians/second and newton-metres.
在文件 Joint2D.cpp 第 221 行定义.
◆ setWheelSpring()
| void eve::physics::Joint2D::setWheelSpring | ( | float | frequencyHz, |
| float | dampingRatio | ||
| ) |
友元及相关函数文档
◆ Body
◆ Mechanism2D
|
friend |
◆ World
该类的文档由以下文件生成:
- src/modules/physics/Joint2D.h
- src/modules/physics/Joint2D.cpp