cocos2d-x  3.5
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PhysicsJoint Class Referenceabstract

An PhysicsJoint object connects two physics bodies together. More...

#include <CCPhysicsJoint.h>

Inheritance diagram for PhysicsJoint:
PhysicsJointDistance PhysicsJointFixed PhysicsJointGear PhysicsJointGroove PhysicsJointLimit PhysicsJointMotor PhysicsJointPin PhysicsJointRatchet PhysicsJointRotaryLimit PhysicsJointRotarySpring PhysicsJointSpring

Public Member Functions

PhysicsBodygetBodyA () const
 Get physics body a connected to this joint. More...
 
PhysicsBodygetBodyB () const
 Get physics body b connected to this joint. More...
 
PhysicsWorldgetWorld () const
 Get the physics world. More...
 
int getTag () const
 Get this joint's tag. More...
 
void setTag (int tag)
 Set this joint's tag. More...
 
bool isEnabled () const
 Determines if the joint is enable. More...
 
void setEnable (bool enable)
 Enable/Disable the joint. More...
 
bool isCollisionEnabled () const
 Determines if the collsion is enable. More...
 
void setCollisionEnable (bool enable)
 Enable/disable the collision between two bodies. More...
 
void removeFormWorld ()
 Remove the joint from the world. More...
 
void setMaxForce (float force)
 Set the max force between two bodies. More...
 
float getMaxForce () const
 Get the max force setting. More...
 

Protected Member Functions

 PhysicsJoint ()
virtual ~PhysicsJoint ()=0
bool init (PhysicsBody *a, PhysicsBody *b)
bool initJoint ()
virtual bool createConstraints ()
 Create constraints for this type joint. More...
 

Protected Attributes

std::vector< cpConstraint * > _cpConstraints
PhysicsBody_bodyA
PhysicsBody_bodyB
PhysicsWorld_world
bool _enable
bool _collisionEnable
bool _destoryMark
int _tag
float _maxForce
bool _initDirty

Friends

class PhysicsBody
class PhysicsWorld
class PhysicsDebugDraw

Detailed Description

An PhysicsJoint object connects two physics bodies together.

Constructor & Destructor Documentation

PhysicsJoint ( )
protected
virtual ~PhysicsJoint ( )
protectedpure virtual

Member Function Documentation

virtual bool createConstraints ( )
inlineprotectedvirtual
PhysicsBody* getBodyA ( ) const
inline

Get physics body a connected to this joint.

PhysicsBody* getBodyB ( ) const
inline

Get physics body b connected to this joint.

float getMaxForce ( ) const
inline

Get the max force setting.

int getTag ( ) const
inline

Get this joint's tag.

Returns
An interger number.
PhysicsWorld* getWorld ( ) const
inline

Get the physics world.

bool init ( PhysicsBody a,
PhysicsBody b 
)
protected
bool initJoint ( )
protected
bool isCollisionEnabled ( ) const
inline

Determines if the collsion is enable.

bool isEnabled ( ) const
inline

Determines if the joint is enable.

void removeFormWorld ( )

Remove the joint from the world.

void setCollisionEnable ( bool  enable)

Enable/disable the collision between two bodies.

void setEnable ( bool  enable)

Enable/Disable the joint.

void setMaxForce ( float  force)

Set the max force between two bodies.

void setTag ( int  tag)
inline

Set this joint's tag.

Parameters
tagAn interger number that identifies a PhysicsJoint.

Friends And Related Function Documentation

friend class PhysicsBody
friend
friend class PhysicsDebugDraw
friend
friend class PhysicsWorld
friend

Member Data Documentation

PhysicsBody* _bodyA
protected
PhysicsBody* _bodyB
protected
bool _collisionEnable
protected
std::vector<cpConstraint*>
_cpConstraints
protected
bool _destoryMark
protected
bool _enable
protected
bool _initDirty
protected
float _maxForce
protected
int _tag
protected
PhysicsWorld* _world
protected

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