An Joint2D object connects two physics bodies together.
More...
#include <Joint2D.h>
Inherited by DistanceJoint2D, FilterJoint2D, FixedJoint2D, and .
|
| bool | isAttached () const |
| | Check if this joint is currently attached to the physics world.
|
| PhysicsWorld2D * | getWorld () const |
| | Get the physics world that owns this joint.
|
| Rigidbody2D * | getAttachedBody () const |
| | Get the primary body (body A) attached to this joint.
|
| void | setConnectedBody (Rigidbody2D *body) |
| | Set the secondary body (body B) connected to this joint.
|
| Rigidbody2D * | getConnectedBody () const |
| | Get the secondary body (body B) connected to this joint.
|
| AnchorSpace | getAnchorSpace () const |
| | Get the current anchor space mode.
|
| void | setAnchorSpace (AnchorSpace space) |
| | Set the anchor space mode.
|
| void | setAnchorsInWorldSpace (const Vec2 &anchor) |
| | Set both attached and connected anchors in world coordinates.
|
| Vec2 | getAnchor () const |
| | Get the anchor point of the attached body.
|
| void | setAnchors (const Vec2 &anchor, const Vec2 &connectedAnchor) |
| | Set both anchors in the current coordinate space.
|
| void | setAnchor (const Vec2 &anchor) |
| | Set the anchor point of the attached body in the current coordinate space.
|
| Vec2 | getConnectedAnchor () const |
| | Get the anchor point of the connected body.
|
| void | setConnectedAnchor (const Vec2 &anchor) |
| | Set the anchor point of the connected body in the current coordinate space.
|
| bool | isCollisionEnabled () const |
| | Check if collision between the two bodies is enabled.
|
| void | setCollisionEnabled (bool enable) |
| | Enable or disable collision between the two bodies connected by this joint.
|
| void | setAutoConfigureConnectedAnchor (bool val) |
| | Enable or disable automatic configuration of the connected anchor.
|
| bool | isAutoConfigureConnectedAnchor () const |
| | Check if automatic configuration of the connected anchor is enabled.
|
| void | setDrawScale (float scale) |
| | Set the debug draw scale for this joint.
|
| int | getTag () const |
| | Get this joint's tag.
|
| void | setTag (int tag) |
| | Set this joint's tag.
|
An Joint2D object connects two physics bodies together.
◆ isAttached()
| bool isAttached |
( |
| ) |
const |
|
inline |
Check if this joint is currently attached to the physics world.
- Returns
- True if the joint is valid and attached, false otherwise.
◆ getWorld()
| PhysicsWorld2D * getWorld |
( |
| ) |
const |
|
inline |
Get the physics world that owns this joint.
- Returns
- Pointer to the PhysicsWorld2D instance.
◆ getAttachedBody()
| Rigidbody2D * getAttachedBody |
( |
| ) |
const |
|
inline |
Get the primary body (body A) attached to this joint.
- Returns
- Pointer to the attached Rigidbody2D.
◆ setConnectedBody()
| void setConnectedBody |
( |
Rigidbody2D * | body | ) |
|
Set the secondary body (body B) connected to this joint.
- Parameters
-
◆ getConnectedBody()
| Rigidbody2D * getConnectedBody |
( |
| ) |
const |
|
inline |
Get the secondary body (body B) connected to this joint.
- Returns
- Pointer to the connected Rigidbody2D.
◆ getAnchorSpace()
| AnchorSpace getAnchorSpace |
( |
| ) |
const |
|
inline |
Get the current anchor space mode.
- Returns
- The anchor space (local or world).
◆ setAnchorSpace()
| void setAnchorSpace |
( |
AnchorSpace | space | ) |
|
|
inline |
Set the anchor space mode.
- Parameters
-
| space | The anchor space (local or world). |
◆ setAnchorsInWorldSpace()
| void setAnchorsInWorldSpace |
( |
const Vec2 & | anchor | ) |
|
Set both attached and connected anchors in world coordinates.
This method forces the joint to use world space for anchors. Both the attached body anchor and the connected body anchor will be set to the same world-space position provided.
- Parameters
-
| anchor | The anchor position in world space. |
◆ getAnchor()
Get the anchor point of the attached body.
- Returns
- The anchor position in current coordinate space.
◆ setAnchors()
| void setAnchors |
( |
const Vec2 & | anchor, |
|
|
const Vec2 & | connectedAnchor ) |
|
inline |
Set both anchors in the current coordinate space.
- Parameters
-
| anchor | Anchor position for the attached body. |
| connectedAnchor | Anchor position for the connected body. |
◆ setAnchor()
| void setAnchor |
( |
const Vec2 & | anchor | ) |
|
Set the anchor point of the attached body in the current coordinate space.
- Parameters
-
| anchor | The anchor position. |
◆ getConnectedAnchor()
| Vec2 getConnectedAnchor |
( |
| ) |
const |
|
inline |
Get the anchor point of the connected body.
- Returns
- The connected anchor position in current coordinate space.
◆ setConnectedAnchor()
| void setConnectedAnchor |
( |
const Vec2 & | anchor | ) |
|
Set the anchor point of the connected body in the current coordinate space.
- Parameters
-
| anchor | The connected anchor position. |
◆ isCollisionEnabled()
| bool isCollisionEnabled |
( |
| ) |
const |
|
inline |
Check if collision between the two bodies is enabled.
- Returns
- True if collision is enabled, false otherwise.
◆ setCollisionEnabled()
| void setCollisionEnabled |
( |
bool | enable | ) |
|
Enable or disable collision between the two bodies connected by this joint.
- Parameters
-
| enable | True to enable collision, false to disable. |
◆ setAutoConfigureConnectedAnchor()
| void setAutoConfigureConnectedAnchor |
( |
bool | val | ) |
|
Enable or disable automatic configuration of the connected anchor.
- Parameters
-
| val | True to auto-configure, false to use manual settings. |
◆ isAutoConfigureConnectedAnchor()
| bool isAutoConfigureConnectedAnchor |
( |
| ) |
const |
|
inline |
Check if automatic configuration of the connected anchor is enabled.
- Returns
- True if auto-configuration is enabled, false otherwise.
◆ setDrawScale()
| void setDrawScale |
( |
float | scale | ) |
|
|
inline |
Set the debug draw scale for this joint.
A scale of 0 disables joint debug drawing. This depends on Axmol's modifications to Box2D joint rendering logic.
- Parameters
-
| scale | The scale factor for debug drawing. |
◆ getTag()
Get this joint's tag.
- Returns
- An integer identifier for the joint.
◆ setTag()
Set this joint's tag.
- Parameters
-
| tag | An integer identifier for the joint. |
The documentation for this class was generated from the following file: