Axmol 3.0.0-89d6d9a
Loading...
Searching...
No Matches
Joint3D Class Referenceabstract

Base class for 3D joints. More...

#include <Joint3D.h>

Public Types

enum class  CoordinateSpace { Local , World }
 Anchor coordinate space understood by Joint3D. More...

Public Member Functions

 ~Joint3D () override
 Destructor.
void onEnter () override
 Called when the component enters the active scene graph.
void onExit () override
 Called when the component exits the active scene graph.
bool isAttached () const
 Returns whether the native physics constraint has been created and attached.
PhysicsWorld3D * getWorld () const
 Returns the physics world that currently owns the joint, or nullptr when detached.
Rigidbody3D * getAttachedBody () const
 Returns the rigid body on the same node as this component.
Rigidbody3D * getConnectedBody () const
 Returns the other rigid body connected by this joint.
void setConnectedBody (Rigidbody3D *body)
 Assigns the rigid body connected on the far side of the joint.
CoordinateSpace getCoordinateSpace () const
 Returns the coordinate space used by anchor and axis values.
void setCoordinateSpace (CoordinateSpace space)
 Sets the coordinate space used by anchors and axes.
void setAnchorsInWorldSpace (const Vec3 &anchor)
 Sets both anchors to the same world-space position.
void setAnchors (const Vec3 &anchor, const Vec3 &connectedAnchor)
 Sets the joint anchors for both rigid bodies.
const Vec3 & getAnchor () const
 Returns the anchor on the attached body.
virtual void setAnchor (const Vec3 &anchor)
 Sets the anchor on the attached body.
const Vec3 & getConnectedAnchor () const
 Returns the anchor on the connected body.
virtual void setConnectedAnchor (const Vec3 &anchor)
 Sets the anchor on the connected body.
void setAxesInWorldSpace (const Vec3 &axis)
 Sets both axes to the same world-space position.
void setAxes (const Vec3 &axis, const Vec3 &connectedAxis)
 Sets the joint axes for both rigid bodies.
const Vec3 & getAxis () const
 Returns the attached body's joint axis.
void setAxis (const Vec3 &axis)
 Sets the attached body's joint axis.
const Vec3 & getConnectedAxis () const
 Returns the secondary body's joint axis.
virtual void setConnectedAxis (const Vec3 &axis)
 Sets the connected body's joint axis.
JPH::Constraint * internalHandle () const
 Returns the underlying native constraint pointer.
void setUserData (void *userData)
 Stores opaque user data on the joint component.
void * getUserData () const
 Returns the opaque user data pointer assigned to this joint.

Detailed Description

Base class for 3D joints.

Joint connects the Rigidbody3D on the same node (bodyA) to another Rigidbody3D (bodyB).

Member Enumeration Documentation

◆ CoordinateSpace

enum class CoordinateSpace
strong

Anchor coordinate space understood by Joint3D.

Enumerator
Local 

Anchor and axis values are relative to each rigid body's center of mass.

World 

Anchor and axis values are expressed in world space.

Member Function Documentation

◆ setConnectedBody()

void setConnectedBody ( Rigidbody3D * body)

Assigns the rigid body connected on the far side of the joint.

Parameters
bodyThe connected rigid body. This can only be set once.

◆ setCoordinateSpace()

void setCoordinateSpace ( CoordinateSpace space)
inline

Sets the coordinate space used by anchors and axes.

Parameters
spaceThe new anchor space.

◆ setAnchorsInWorldSpace()

void setAnchorsInWorldSpace ( const Vec3 & anchor)

Sets both anchors to the same world-space position.

Parameters
anchorThe shared world-space anchor point.

◆ setAnchors()

void setAnchors ( const Vec3 & anchor,
const Vec3 & connectedAnchor )
inline

Sets the joint anchors for both rigid bodies.

The values are interpreted in the current coordinate space.

Parameters
anchorAnchor on the attached rigid body.
connectedAnchorAnchor on the connected rigid body.

◆ setAnchor()

virtual void setAnchor ( const Vec3 & anchor)
virtual

Sets the anchor on the attached body.

Parameters
anchorThe anchor value in the current anchor space.

◆ setConnectedAnchor()

virtual void setConnectedAnchor ( const Vec3 & anchor)
virtual

Sets the anchor on the connected body.

Parameters
anchorThe anchor value in the current anchor space.

◆ setAxesInWorldSpace()

void setAxesInWorldSpace ( const Vec3 & axis)

Sets both axes to the same world-space position.

Parameters
axisThe shared world-space axis.

◆ setAxes()

void setAxes ( const Vec3 & axis,
const Vec3 & connectedAxis )
inline

Sets the joint axes for both rigid bodies.

The values are interpreted in the current coordinate space.

Parameters
axisAxis on the attached rigid body.
connectedAxisAxis on the connected rigid body.

◆ setAxis()

void setAxis ( const Vec3 & axis)

Sets the attached body's joint axis.

Parameters
axisThe axis expressed in the current anchor space.

◆ setConnectedAxis()

virtual void setConnectedAxis ( const Vec3 & axis)
virtual

Sets the connected body's joint axis.

Parameters
axisThe axis expressed in the current anchor space.

◆ setUserData()

void setUserData ( void * userData)
inline

Stores opaque user data on the joint component.

Parameters
userDataCaller-owned user pointer.

The documentation for this class was generated from the following file:
  • Joint3D.h