#include <PulleyJoint2D.hpp>
|
| PulleyJoint2D (World2D &worldRef, RigidBody2D &bodyA, RigidBody2D &bodyB, const bool collide, const float ratio, const glm::vec2 &groundAnchorA, const glm::vec2 &groundAnchorB, const glm::vec2 &localAnchorA=glm::vec2(0.f, 0.f), const glm::vec2 &localAnchorB=glm::vec2(0.f, 0.f)) |
| PulleyJoint2D constructor. More...
|
|
std::pair< float, float > | getRopeLengths () const |
|
| Joint2D (World2D &worldRef, RigidBody2D &bodyA, RigidBody2D &bodyB, const bool collide) |
| Joint2D constructor. More...
|
|
virtual | ~Joint2D ()=0 |
|
unsigned int | getID () const |
| Get joint ID. More...
|
|
Joint2D & | setID (const unsigned int id) |
| Set new ID for the joint. More...
|
|
Definition at line 38 of file PulleyJoint2D.hpp.
jop::PulleyJoint2D::PulleyJoint2D |
( |
World2D & |
worldRef, |
|
|
RigidBody2D & |
bodyA, |
|
|
RigidBody2D & |
bodyB, |
|
|
const bool |
collide, |
|
|
const float |
ratio, |
|
|
const glm::vec2 & |
groundAnchorA, |
|
|
const glm::vec2 & |
groundAnchorB, |
|
|
const glm::vec2 & |
localAnchorA = glm::vec2(0.f, 0.f) , |
|
|
const glm::vec2 & |
localAnchorB = glm::vec2(0.f, 0.f) |
|
) |
| |
PulleyJoint2D constructor.
- Note
- These pulleys have the other end as a static attachment to the world. If the user wishes to create a pulley that also moves sideways, the user can create one in the following way: Create four RigidBody2Ds. Attach two of them with WeldJoint2D. Attach a free body to either welded body via PulleyJoint2D. Attach final body to the other welded body via PulleyJoint2D. Create logic between the PulleyJoint2Ds and apply forces to a welded body.
- Parameters
-
ratio | Ratio for which the ropes move in relation to each other. |
groundAnchorA | World coordinates for attachment point of the second end of the rope for body A. |
groundAnchorB | World coordinates for attachment point of the second end of the rope for body B. |
localAnchorA | Local coordinates of body A to attach the rope to. Uses local center of the object if left empty. Please use values between -1.f and 1.f. |
localAnchorB | Local coordinates of body B to attach the rope to. Uses local center of the object if left empty. Please use values between -1.f and 1.f. |
- Returns
- PulleyJoint2D
std::pair<float, float> jop::PulleyJoint2D::getRopeLengths |
( |
| ) |
const |
- Returns
- Returns current rope lengths: first = bodyA, second = bodyB
The documentation for this class was generated from the following file: