ReactPhysics3D: reactphysics3d::HingeJoint Class Reference

| ReactPhysics3D v0.10.2 C++ Physics engine library

Loading...
Searching...
No Matches
Public Member Functions | List of all members
reactphysics3d::HingeJoint Class Reference

This class represents a hinge joint that allows arbitrary rotation between two bodies around a single axis. More...

`#include <include/reactphysics3d/constraint/HingeJoint.h>`

Inheritance diagram for reactphysics3d::HingeJoint:

## Public Member Functions
| HingeJoint (Entity entity, PhysicsWorld &world, const HingeJointInfo &jointInfo)
| Constructor.
virtual | ~HingeJoint () override=default
| Destructor.
| HingeJoint (const HingeJoint &constraint)=delete
| Deleted copy-constructor.
HingeJoint & | operator= (const HingeJoint &constraint)=delete
| Deleted assignment operator.
bool | isLimitEnabled () const
| Return true if the limits or the joint are enabled.
bool | isMotorEnabled () const
| Return true if the motor of the joint is enabled.
void | enableLimit (bool isLimitEnabled)
| Enable/Disable the limits of the joint.
void | enableMotor (bool isMotorEnabled)
| Enable/Disable the motor of the joint.
decimal | getMinAngleLimit () const
| Return the minimum angle limit.
void | setMinAngleLimit (decimal lowerLimit)
| Set the minimum angle limit.
decimal | getMaxAngleLimit () const
| Return the maximum angle limit.
void | setMaxAngleLimit (decimal upperLimit)
| Set the maximum angle limit.
decimal | getMotorSpeed () const
| Return the motor speed.
void | setMotorSpeed (decimal motorSpeed)
| Set the motor speed.
decimal | getMaxMotorTorque () const
| Return the maximum motor torque.
void | setMaxMotorTorque (decimal maxMotorTorque)
| Set the maximum motor torque.
decimal | getMotorTorque (decimal timeStep) const
| Return the intensity of the current torque applied for the joint motor.
decimal | getAngle () const
| Return the current hinge angle (in radians)
virtual Vector3 | getReactionForce (decimal timeStep) const override
| Return the force (in Newtons) on body 2 required to satisfy the joint constraint in world-space.
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.
virtual std::string | to_string () const override
| Return a string representation.
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.
Joint & | operator= (const Joint &constraint)=delete
| Deleted assignment operator.
RigidBody * | getBody1 () const
| Return the reference to the body 1.
RigidBody * | getBody2 () const
| Return the reference to the body 2.
JointType | getType () const
| Return the type of the constraint.
virtual Vector3 | getReactionForce (decimal timeStep) const =0
| Return the force (in Newtons) on body 2 required to satisfy the joint constraint.
virtual Vector3 | getReactionTorque (decimal timeStep) const =0
| Return the torque (in Newtons * meters) on body 2 required to satisfy the joint constraint.
bool | isCollisionEnabled () const
| Return true if the collision between the two bodies of the joint is enabled.
Entity | getEntity () const
| Return the entity id of the joint.
virtual std::string | to_string () const =0
| Return a string representation.

## Detailed Description

This class represents a hinge joint that allows arbitrary rotation between two bodies around a single axis.

This joint has one degree of freedom. It can be useful to simulate doors or pendulumns.

## Member Function Documentation

## ◆ enableLimit()

void HingeJoint::enableLimit | ( | bool | isLimitEnabled | ) |

Enable/Disable the limits of the joint.

Parameters

  isLimitEnabled | True if you want to enable the limits of the joint and false otherwise

## ◆ enableMotor()

void HingeJoint::enableMotor | ( | bool | isMotorEnabled | ) |

Enable/Disable the motor of the joint.

Parameters

  isMotorEnabled | True if you want to enable the motor of the joint and false otherwise

## ◆ getAngle()

decimal HingeJoint::getAngle | ( |  | ) | const

Return the current hinge angle (in radians)

Returns
  The current hinge angle (in radians) in the range [-pi; pi]

## ◆ getMaxAngleLimit()

decimal HingeJoint::getMaxAngleLimit | ( |  | ) | const

Return the maximum angle limit.

Returns
  The maximum limit angle of the joint (in radian)

## ◆ getMaxMotorTorque()

decimal HingeJoint::getMaxMotorTorque | ( |  | ) | const

Return the maximum motor torque.

Returns
  The maximum torque of the joint motor (in Newtons)

## ◆ getMinAngleLimit()

decimal HingeJoint::getMinAngleLimit | ( |  | ) | const

Return the minimum angle limit.

Returns
  The minimum limit angle of the joint (in radian)

## ◆ getMotorSpeed()

decimal HingeJoint::getMotorSpeed | ( |  | ) | const

Return the motor speed.

Returns
  The current speed of the joint motor (in radian per second)

## ◆ getMotorTorque()

decimal HingeJoint::getMotorTorque | ( | decimal | timeStep | ) | const

Return the intensity of the current torque applied for the joint motor.

Parameters

  timeStep | The current time step (in seconds)

Returns
  The intensity of the current torque (in Newtons) of the joint motor

## ◆ getReactionForce()

Vector3 HingeJoint::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 HingeJoint::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) applied on body 2

Implements reactphysics3d::Joint.

## ◆ isLimitEnabled()

bool HingeJoint::isLimitEnabled | ( |  | ) | const

Return true if the limits or the joint are enabled.

Returns
  True if the limits of the joint are enabled and false otherwise

## ◆ isMotorEnabled()

bool HingeJoint::isMotorEnabled | ( |  | ) | const

Return true if the motor of the joint is enabled.

Returns
  True if the motor of joint is enabled and false otherwise

## ◆ setMaxAngleLimit()

void HingeJoint::setMaxAngleLimit | ( | decimal | upperLimit | ) |

Set the maximum angle limit.

Parameters

  upperLimit | The maximum limit angle of the joint (in radian)

## ◆ setMaxMotorTorque()

void HingeJoint::setMaxMotorTorque | ( | decimal | maxMotorTorque | ) |

Set the maximum motor torque.

Parameters

  maxMotorTorque | The maximum torque (in Newtons) of the joint motor

## ◆ setMinAngleLimit()

void HingeJoint::setMinAngleLimit | ( | decimal | lowerLimit | ) |

Set the minimum angle limit.

Parameters

  lowerLimit | The minimum limit angle of the joint (in radian)

## ◆ setMotorSpeed()

void HingeJoint::setMotorSpeed | ( | decimal | motorSpeed | ) |

Set the motor speed.

Parameters

  motorSpeed | The speed of the motor

## ◆ to_string()

std::string HingeJoint::to_string | ( |  | ) | const
| overridevirtual

Return a string representation.

Implements reactphysics3d::Joint.

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

- include/reactphysics3d/constraint/HingeJoint.h
- src/constraint/HingeJoint.cpp