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...
 
local getBodyA ()
 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
var _cpConstraints
local _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
var PhysicsJoint ( )
protected
local PhysicsJoint ( )
protected
virtual ~PhysicsJoint ( )
protectedpure virtual
var ~PhysicsJoint ( )
protectedpure virtual
local ~PhysicsJoint ( )
protectedpure virtual

Member Function Documentation

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

Get physics body a connected to this joint.

var getBodyA ( )
inline

Get physics body a connected to this joint.

local getBodyA ( )
inline

Get physics body a connected to this joint.

PhysicsBody* getBodyB ( ) const
inline

Get physics body b connected to this joint.

var getBodyB ( )
inline

Get physics body b connected to this joint.

local getBodyB ( )
inline

Get physics body b connected to this joint.

float getMaxForce ( ) const
inline

Get the max force setting.

var getMaxForce ( )
inline

Get the max force setting.

local getMaxForce ( )
inline

Get the max force setting.

int getTag ( ) const
inline

Get this joint's tag.

Returns
An interger number.
var getTag ( )
inline

Get this joint's tag.

Returns
An interger number.
local getTag ( )
inline

Get this joint's tag.

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

Get the physics world.

var getWorld ( )
inline

Get the physics world.

local getWorld ( )
inline

Get the physics world.

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

Determines if the collsion is enable.

var isCollisionEnabled ( )
inline

Determines if the collsion is enable.

local isCollisionEnabled ( )
inline

Determines if the collsion is enable.

bool isEnabled ( ) const
inline

Determines if the joint is enable.

var isEnabled ( )
inline

Determines if the joint is enable.

local isEnabled ( )
inline

Determines if the joint is enable.

void removeFormWorld ( )

Remove the joint from the world.

var removeFormWorld ( )

Remove the joint from the world.

local removeFormWorld ( )

Remove the joint from the world.

void setCollisionEnable ( bool  enable)

Enable/disable the collision between two bodies.

var setCollisionEnable ( var  enable)

Enable/disable the collision between two bodies.

local setCollisionEnable ( local  enable)

Enable/disable the collision between two bodies.

void setEnable ( bool  enable)

Enable/Disable the joint.

var setEnable ( var  enable)

Enable/Disable the joint.

local setEnable ( local  enable)

Enable/Disable the joint.

void setMaxForce ( float  force)

Set the max force between two bodies.

var setMaxForce ( var  force)

Set the max force between two bodies.

local setMaxForce ( local  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.
var setTag ( var  tag)
inline

Set this joint's tag.

Parameters
tagAn interger number that identifies a PhysicsJoint.
local setTag ( local  tag)
inline

Set this joint's tag.

Parameters
tagAn interger number that identifies a PhysicsJoint.

Friends And Related Function Documentation

friend class PhysicsBody
friend
var PhysicsBody
friend
local PhysicsBody
friend
friend class PhysicsDebugDraw
friend
var PhysicsDebugDraw
friend
local PhysicsDebugDraw
friend
friend class PhysicsWorld
friend
var PhysicsWorld
friend
local PhysicsWorld
friend

Member Data Documentation

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

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