Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
jop::Joint Class Referenceabstract

#include <Joint.hpp>

Inheritance diagram for jop::Joint:
jop::GearJoint jop::PistonJoint jop::RopeJoint jop::RotationJoint jop::WeldJoint jop::WheelJoint

Public Member Functions

 Joint (World &worldRef, RigidBody &bodyA, RigidBody &bodyB, const bool collide)
 Joint constructor. More...
 
virtual ~Joint ()=0
 
unsigned int getID () const
 Get joint ID. More...
 
JointsetID (const unsigned int id)
 Set new ID for the joint. More...
 

Public Attributes

Worldm_worldRef
 Pointer to the world. More...
 
RigidBodym_bodyA
 Pointer to bodyA. More...
 
RigidBodym_bodyB
 Pointer to bodyB. More...
 

Protected Member Functions

btRigidBody * getBody (RigidBody &body) const
 Return engine internal pointer to body. More...
 
btDiscreteDynamicsWorld & getWorld (World &world) const
 Return engine internal pointer to world. More...
 
glm::vec3 defaultCenter (const glm::vec3 &jPos) const
 
glm::vec3 computeCenter () const
 Calculates the point in the middle between this' m_bodies. More...
 

Protected Attributes

bool m_collide
 
std::unique_ptr< btTypedConstraint > m_joint
 < Should the linked bodies collide. More...
 
unsigned int m_ID
 Joint ID. More...
 

Friends

class RigidBody
 

Detailed Description

Definition at line 43 of file Joint.hpp.

Constructor & Destructor Documentation

jop::Joint::Joint ( World worldRef,
RigidBody bodyA,
RigidBody bodyB,
const bool  collide 
)

Joint constructor.

Parameters
worldRefReference to the current world. Obtained and handled by the engine.
bodyARigidBody where to attach this joint. Received automatically from the calling function.
bodyBRigidBody in which to attach the second end of the joint. Given by user as the first argument.
collideBoolean whether the linked bodies should collide with each other.
virtual jop::Joint::~Joint ( )
pure virtual

Member Function Documentation

glm::vec3 jop::Joint::computeCenter ( ) const
protected

Calculates the point in the middle between this' m_bodies.

Returns
Returns the point as glm::vec3.
glm::vec3 jop::Joint::defaultCenter ( const glm::vec3 &  jPos) const
protected

Checks if the joint position is default (declared in the function) Returns the current position if not default. Returns the middle between the m_bodies if default.

Parameters
jPosCurrent position of the joint.
Returns
Returns the joint position as glm::vec3.
btRigidBody* jop::Joint::getBody ( RigidBody body) const
protected

Return engine internal pointer to body.

Parameters
bodyRigidBody2D.
Returns
Returns pointer to Box2D body.
unsigned int jop::Joint::getID ( ) const

Get joint ID.

Returns
Returns ID of the joint.
btDiscreteDynamicsWorld& jop::Joint::getWorld ( World world) const
protected

Return engine internal pointer to world.

Parameters
worldWorld.
Returns
Returns reference to Bullet world.
Joint& jop::Joint::setID ( const unsigned int  id)

Set new ID for the joint.

Parameters
idNew ID to set.
Returns
Returns reference to self.

Friends And Related Function Documentation

friend class RigidBody
friend

Definition at line 45 of file Joint.hpp.

Member Data Documentation

RigidBody* jop::Joint::m_bodyA

Pointer to bodyA.

Definition at line 75 of file Joint.hpp.

RigidBody* jop::Joint::m_bodyB

Pointer to bodyB.

Definition at line 76 of file Joint.hpp.

bool jop::Joint::m_collide
protected

Definition at line 112 of file Joint.hpp.

unsigned int jop::Joint::m_ID
protected

Joint ID.

Definition at line 114 of file Joint.hpp.

std::unique_ptr<btTypedConstraint> jop::Joint::m_joint
protected

< Should the linked bodies collide.

Pointer to Bullet joint.

Definition at line 113 of file Joint.hpp.

World* jop::Joint::m_worldRef

Pointer to the world.

Definition at line 74 of file Joint.hpp.


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