ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::BallAndSocketJoint Class Reference

This class represents a ball-and-socket joint that allows arbitrary rotation between two bodies. More...

#include <include/reactphysics3d/constraint/BallAndSocketJoint.h>

Inheritance diagram for reactphysics3d::BallAndSocketJoint:
reactphysics3d::Joint

Public Member Functions

 BallAndSocketJoint (Entity entity, PhysicsWorld &world, const BallAndSocketJointInfo &jointInfo)
 Constructor.
 
virtual ~BallAndSocketJoint () override=default
 Destructor.
 
 BallAndSocketJoint (const BallAndSocketJoint &constraint)=delete
 Deleted copy-constructor.
 
void enableConeLimit (bool isLimitEnabled)
 Enable/disable the cone limit of the joint. More...
 
bool isConeLimitEnabled () const
 Return true if the cone limit or the joint is enabled. More...
 
void setConeLimitHalfAngle (decimal coneHalfAngle)
 Set the cone limit half angle. More...
 
decimal getConeLimitHalfAngle () const
 Return the cone limit half angle (in radians) More...
 
decimal getConeHalfAngle () const
 Return the current cone half angle (in radians) More...
 
virtual Vector3 getReactionForce (decimal timeStep) const override
 Return the force (in Newtons) on body 2 required to satisfy the joint constraint in world-space. More...
 
virtual Vector3 getReactionTorque (decimal timeStep) const override
 Return the torque (in Newtons * meters) on body 2 required to satisfy the joint constraint in world-space. More...
 
virtual std::string to_string () const override
 Return a string representation.
 
BallAndSocketJointoperator= (const BallAndSocketJoint &constraint)=delete
 Deleted assignment operator.
 
- Public Member Functions inherited from reactphysics3d::Joint
 Joint (Entity entity, PhysicsWorld &world)
 Constructor.
 
virtual ~Joint ()=default
 Destructor.
 
 Joint (const Joint &constraint)=delete
 Deleted copy-constructor.
 
Jointoperator= (const Joint &constraint)=delete
 Deleted assignment operator.
 
RigidBodygetBody1 () const
 Return the reference to the body 1. More...
 
RigidBodygetBody2 () const
 Return the reference to the body 2. More...
 
JointType getType () const
 Return the type of the constraint. More...
 
bool isCollisionEnabled () const
 Return true if the collision between the two bodies of the joint is enabled. More...
 
Entity getEntity () const
 Return the entity id of the joint. More...
 

Detailed Description

This class represents a ball-and-socket joint that allows arbitrary rotation between two bodies.

This joint has three degrees of freedom. It can be used to create a chain of bodies for instance.

Member Function Documentation

◆ enableConeLimit()

void BallAndSocketJoint::enableConeLimit ( bool  isLimitEnabled)

Enable/disable the cone limit of the joint.

It is possible to enable a cone-limit for the BallAndSocketJoint in order to restrict the angular motion between the two bodies.

Use this method to enable/disable the cone-limit.

Parameters
isLimitEnabledTrue if the limit must be enabled and false otherwise

◆ getConeHalfAngle()

decimal BallAndSocketJoint::getConeHalfAngle ( ) const

Return the current cone half angle (in radians)

Returns
The current half-angle (in radians) of the joint with respect to the cone-limit axis

◆ getConeLimitHalfAngle()

decimal BallAndSocketJoint::getConeLimitHalfAngle ( ) const

Return the cone limit half angle (in radians)

Returns
The half-angle (in radians) of the cone-limit

◆ getReactionForce()

Vector3 BallAndSocketJoint::getReactionForce ( decimal  timeStep) const
overridevirtual

Return the force (in Newtons) on body 2 required to satisfy the joint constraint in world-space.

Returns
The current force (in Newtons) applied on body 2

Implements reactphysics3d::Joint.

◆ getReactionTorque()

Vector3 BallAndSocketJoint::getReactionTorque ( decimal  timeStep) const
overridevirtual

Return the torque (in Newtons * meters) on body 2 required to satisfy the joint constraint in world-space.

Returns
The current torque (in Newtons * meters) on body 2

Implements reactphysics3d::Joint.

◆ isConeLimitEnabled()

bool BallAndSocketJoint::isConeLimitEnabled ( ) const

Return true if the cone limit or the joint is enabled.

Returns
True if the cone-limit is enabled for this joint

◆ setConeLimitHalfAngle()

void BallAndSocketJoint::setConeLimitHalfAngle ( decimal  coneHalfAngle)

Set the cone limit half angle.

Parameters
coneHalfAngleThe angle of the cone limit (in radian) from [0; PI]

The documentation for this class was generated from the following files: