Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Member Functions | List of all members
jop::RotationJoint2D Class Reference

#include <RotationJoint2D.hpp>

Inheritance diagram for jop::RotationJoint2D:
jop::Joint2D

Public Member Functions

 RotationJoint2D (World2D &worldRef, RigidBody2D &bodyA, RigidBody2D &bodyB, const bool collide, const glm::vec2 &localAnchorA=glm::vec2(0.f, 0.f))
 RotationJoint2D constructor. More...
 
RotationJoint2Dlimit (const bool enable)
 
RotationJoint2DsetLimits (const float minAngle, const float maxAngle)
 
std::pair< float, float > getLimits () const
 
- Public Member Functions inherited from jop::Joint2D
 Joint2D (World2D &worldRef, RigidBody2D &bodyA, RigidBody2D &bodyB, const bool collide)
 Joint2D constructor. More...
 
virtual ~Joint2D ()=0
 
unsigned int getID () const
 Get joint ID. More...
 
Joint2DsetID (const unsigned int id)
 Set new ID for the joint. More...
 

Additional Inherited Members

- Public Attributes inherited from jop::Joint2D
World2Dm_worldRef
 Pointer to the world. More...
 
RigidBody2Dm_bodyA
 Pointer to bodyA. More...
 
RigidBody2Dm_bodyB
 Pointer to bodyB. More...
 
- Static Protected Member Functions inherited from jop::Joint2D
static b2Body * getBody (RigidBody2D &body)
 Return engine internal pointer to body. More...
 
- Protected Attributes inherited from jop::Joint2D
bool m_collide
 Should the linked bodies collide. More...
 
b2Joint * m_joint
 Pointer to Box2D joint. More...
 
unsigned int m_ID
 Joint ID. More...
 

Detailed Description

Definition at line 38 of file RotationJoint2D.hpp.

Constructor & Destructor Documentation

jop::RotationJoint2D::RotationJoint2D ( World2D worldRef,
RigidBody2D bodyA,
RigidBody2D bodyB,
const bool  collide,
const glm::vec2 &  localAnchorA = glm::vec2(0.f, 0.f) 
)

RotationJoint2D constructor.

Links the bodyB to a circular track around the bodyA. Movement area can be limited by radians.

Parameters
localAnchorAAnchor point in the bodyA to start the connection from. Local coordinates: -1.f - +1.f. Default is center. Anchor point for bodyB can not changed. It is at the center of bodyB.

Member Function Documentation

std::pair<float, float> jop::RotationJoint2D::getLimits ( ) const
Returns
Returns current rotation limits in radians: first = minimum angle, second = maximum angle.
RotationJoint2D& jop::RotationJoint2D::limit ( const bool  enable)
Parameters
enableEnables/disables obeying rotation limits.
Returns
Returns reference to self.
RotationJoint2D& jop::RotationJoint2D::setLimits ( const float  minAngle,
const float  maxAngle 
)
Parameters
minAngleMinimum angle of rotation in radians.
maxAngleMaximum angle of rotation in radians.

Enables limiting when called.

Returns
Returns reference to self.

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