cocos2d-x  3.0-alpha0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PhysicsBody Class Reference

A body affect by physics. More...

#include <CCPhysicsBody.h>

Inheritance diagram for PhysicsBody:
Object

Public Member Functions

virtual PhysicsShapeCircleaddCircle (float radius, Point offset=Point(0, 0))
 Attach a circle shape with body. More...
 
virtual PhysicsShapeBoxaddBox (Size size, Point offset=Point(0, 0))
 Attach a box shape with body. More...
 
virtual PhysicsShapePolygonaddPolygon (Point *points, int count, Point offset=Point(0, 0))
 Attach a polygon shape with body. More...
 
local addPolygon ( local points, local count, local 0)
 Attach a polygon shape with body. More...
 
virtual PhysicsShapeEdgeSegmentaddEdgeSegment (Point a, Point b, float border=1)
 Attach a edge segment shape with body. More...
 
local addEdgeSegment ( local a, local b, local 1)
 Attach a edge segment shape with body. More...
 
virtual PhysicsShapeEdgeBoxaddEdgeBox (Size size, float border=1, Point offset=Point(0, 0))
 Attach a edge box shape with body. More...
 
local addEdgeBox ( local size, local 1, local 0)
 Attach a edge box shape with body. More...
 
virtual PhysicsShapeEdgePolygonaddEdgePolygon (Point *points, int count, float border=1)
 Attach a edge polygon shape with body points is an array of Point structs defining a convex hull with a clockwise winding. More...
 
var addEdgePolygon ( var points, var count, var 1)
 Attach a edge polygon shape with body points is an array of Point structs defining a convex hull with a clockwise winding. More...
 
local addEdgePolygon ( local points, local count, local 1)
 Attach a edge polygon shape with body points is an array of Point structs defining a convex hull with a clockwise winding. More...
 
virtual PhysicsShapeEdgeChainaddEdgeChain (Point *points, int count, float border=1)
 Attach a edge chain shape with body points is an array of Point structs defining a convex hull with a clockwise winding. More...
 
virtual void applyForce (Point force)
 Applies a immediate force to body. More...
 
virtual void applyForce (Point force, Point offset)
 Applies a immediate force to body. More...
 
local applyForce ( local force, local offset)
 Applies a immediate force to body. More...
 
virtual void applyImpulse (Point impulse)
 Applies a continuous force to body. More...
 
virtual void applyImpulse (Point impulse, Point offset)
 Applies a continuous force to body. More...
 
local applyImpulse ( local impulse, local offset)
 Applies a continuous force to body. More...
 
virtual void applyTorque (float torque)
 Applies a torque force to body. More...
 
var applyTorque ( var torque)
 Applies a torque force to body. More...
 
local applyTorque ( local torque)
 Applies a torque force to body. More...
 
std::vector< PhysicsShape * > & getShapes ()
PhysicsShapegetShape ()
var getShape ()
local getShape ()
void removeShape (PhysicsShape *shape)
local removeShape ( local shape)
void removeAllShapes ()
PhysicsWorldgetWorld () const
local getWorld ()
const std::vector
< PhysicsJoint * > * 
getJoints () const
local getJoints ()
SpritegetOwner () const
local getOwner ()
void setCategoryBitmask (int bitmask)
var setCategoryBitmask ( var bitmask)
local setCategoryBitmask ( local bitmask)
int getCategoryBitmask () const
void setContactTestBitmask (int bitmask)
var setContactTestBitmask ( var bitmask)
local setContactTestBitmask ( local bitmask)
int getContactTestBitmask () const
void setCollisionBitmask (int bitmask)
int getCollisionBitmask () const
Point getPosition () const
float getRotation () const
bool isDynamic ()
void setDynamic (bool dynamic)
local setDynamic ( local dynamic)
void setMass (float mass)
float getMass ()
void setAngularDamping (float angularDamping)
var setAngularDamping ( var angularDamping)
local setAngularDamping ( local angularDamping)
float getAngularDamping ()
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)
virtual void update (float dt)

Static Public Member Functions

static PhysicsBodycreateCircle (float radius)
 Create a body contains a circle shape. More...
 
var createCircle ( var radius)
 Create a body contains a circle shape. More...
 
local createCircle ( local radius)
 Create a body contains a circle shape. More...
 
static PhysicsBodycreateBox (Size size)
 Create a body contains a box shape. More...
 
static PhysicsBodycreatePolygon (Point *points, int count)
 Create a body contains a polygon shape. More...
 
var createPolygon ( var points, var count)
 Create a body contains a polygon shape. More...
 
local createPolygon ( local points, local count)
 Create a body contains a polygon shape. More...
 
static PhysicsBodycreateEdgeSegment (Point a, Point b, float border=1)
 Create a body contains a EdgeSegment shape. More...
 
var createEdgeSegment ( var a, var b, var 1)
 Create a body contains a EdgeSegment shape. More...
 
local createEdgeSegment ( local a, local b, local 1)
 Create a body contains a EdgeSegment shape. More...
 
static PhysicsBodycreateEdgeBox (Size size, float border=1)
 Create a body contains a EdgeBox shape. More...
 
static PhysicsBodycreateEdgePolygon (Point *points, int count, float border=1)
 Create a body contains a EdgePolygon shape. More...
 
static PhysicsBodycreateEdgeChain (Point *points, int count, float border=1)
 Create a body contains a EdgeChain shape. More...
 
local createEdgeChain ( local points, local count, local 1)
 Create a body contains a EdgeChain shape. More...
 

Protected Member Functions

bool init ()
bool initStatic ()
virtual void setPosition (Point position)
local setPosition ( local position)
virtual void setRotation (float rotation)
local setRotation ( local rotation)
virtual void addShape (PhysicsShape *shape)
var addShape ( var shape)
local addShape ( local shape)
 PhysicsBody ()
virtual ~PhysicsBody ()

Protected Attributes

Sprite_owner
var _owner
local _owner
std::vector< PhysicsJoint * > _joints
var _joints
local _joints
std::vector< PhysicsShape * > _shapes
PhysicsWorld_world
PhysicsBodyInfo_info
local _info
bool _dynamic
bool _massDefault
var _massDefault
local _massDefault
bool _angularDampingDefault
var _angularDampingDefault
local _angularDampingDefault
float _mass
float _area
float _density
float _angularDamping
var _angularDamping
local _angularDamping
int _categoryBitmask
var _categoryBitmask
local _categoryBitmask
int _contactTestBitmask
var _contactTestBitmask
local _contactTestBitmask
int _collisionBitmask
var _collisionBitmask
local _collisionBitmask
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
var _reference
 count of references More...
 
local _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 
var _autoReleaseCount
 count of autorelease More...
 
local _autoReleaseCount
 count of autorelease More...
 

Friends

class PhysicsWorld
class PhysicsShape
class PhysicsJoint
class Sprite

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 

Detailed Description

A body affect by physics.

it can attach one or more shapes.

Constructor & Destructor Documentation

PhysicsBody ( )
protected
var PhysicsBody ( )
protected
local PhysicsBody ( )
protected
virtual ~PhysicsBody ( )
protectedvirtual
var ~PhysicsBody ( )
protectedvirtual
local ~PhysicsBody ( )
protectedvirtual

Member Function Documentation

virtual PhysicsShapeBox* addBox ( Size  size,
Point  offset = Point(0, 0) 
)
virtual

Attach a box shape with body.

var addBox ( var  size,
var  offset = Point(0, 0) 
)
virtual

Attach a box shape with body.

local addBox ( local  size,
local  offset = Point(0, 0) 
)
virtual

Attach a box shape with body.

virtual PhysicsShapeCircle*
addCircle
( float  radius,
Point  offset = Point(0, 0) 
)
virtual

Attach a circle shape with body.

var addCircle ( var  radius,
var  offset = Point(0, 0) 
)
virtual

Attach a circle shape with body.

local addCircle ( local  radius,
local  offset = Point(0, 0) 
)
virtual

Attach a circle shape with body.

virtual PhysicsShapeEdgeBox*
addEdgeBox
( Size  size,
float  border = 1,
Point  offset = Point(0, 0) 
)
virtual

Attach a edge box shape with body.

var addEdgeBox ( var  size,
var  border = 1,
var  offset = Point(0, 0) 
)
virtual

Attach a edge box shape with body.

local addEdgeBox ( local  size,
local  border = 1,
local  offset = Point(0, 0) 
)
virtual

Attach a edge box shape with body.

virtual PhysicsShapeEdgeChain*
addEdgeChain
( Point points,
int  count,
float  border = 1 
)
virtual

Attach a edge chain shape with body points is an array of Point structs defining a convex hull with a clockwise winding.

var addEdgeChain ( var  points,
var  count,
var  border = 1 
)
virtual

Attach a edge chain shape with body points is an array of Point structs defining a convex hull with a clockwise winding.

local addEdgeChain ( local  points,
local  count,
local  border = 1 
)
virtual

Attach a edge chain shape with body points is an array of Point structs defining a convex hull with a clockwise winding.

virtual
PhysicsShapeEdgePolygon*
addEdgePolygon
( Point points,
int  count,
float  border = 1 
)
virtual

Attach a edge polygon shape with body points is an array of Point structs defining a convex hull with a clockwise winding.

var addEdgePolygon ( var  points,
var  count,
var  border = 1 
)
virtual

Attach a edge polygon shape with body points is an array of Point structs defining a convex hull with a clockwise winding.

local addEdgePolygon ( local  points,
local  count,
local  border = 1 
)
virtual

Attach a edge polygon shape with body points is an array of Point structs defining a convex hull with a clockwise winding.

virtual
PhysicsShapeEdgeSegment*
addEdgeSegment
( Point  a,
Point  b,
float  border = 1 
)
virtual

Attach a edge segment shape with body.

var addEdgeSegment ( var  a,
var  b,
var  border = 1 
)
virtual

Attach a edge segment shape with body.

local addEdgeSegment ( local  a,
local  b,
local  border = 1 
)
virtual

Attach a edge segment shape with body.

virtual PhysicsShapePolygon*
addPolygon
( Point points,
int  count,
Point  offset = Point(0, 0) 
)
virtual

Attach a polygon shape with body.

var addPolygon ( var  points,
var  count,
var  offset = Point(0, 0) 
)
virtual

Attach a polygon shape with body.

local addPolygon ( local  points,
local  count,
local  offset = Point(0, 0) 
)
virtual

Attach a polygon shape with body.

virtual void addShape ( PhysicsShape shape)
protectedvirtual
var addShape ( var  shape)
protectedvirtual
local addShape ( local  shape)
protectedvirtual
virtual void applyForce ( Point  force)
virtual

Applies a immediate force to body.

var applyForce ( var  force)
virtual

Applies a immediate force to body.

local applyForce ( local  force)
virtual

Applies a immediate force to body.

virtual void applyForce ( Point  force,
Point  offset 
)
virtual

Applies a immediate force to body.

var applyForce ( var  force,
var  offset 
)
virtual

Applies a immediate force to body.

local applyForce ( local  force,
local  offset 
)
virtual

Applies a immediate force to body.

virtual void applyImpulse ( Point  impulse)
virtual

Applies a continuous force to body.

var applyImpulse ( var  impulse)
virtual

Applies a continuous force to body.

local applyImpulse ( local  impulse)
virtual

Applies a continuous force to body.

virtual void applyImpulse ( Point  impulse,
Point  offset 
)
virtual

Applies a continuous force to body.

var applyImpulse ( var  impulse,
var  offset 
)
virtual

Applies a continuous force to body.

local applyImpulse ( local  impulse,
local  offset 
)
virtual

Applies a continuous force to body.

virtual void applyTorque ( float  torque)
virtual

Applies a torque force to body.

var applyTorque ( var  torque)
virtual

Applies a torque force to body.

local applyTorque ( local  torque)
virtual

Applies a torque force to body.

static PhysicsBody* createBox ( Size  size)
static

Create a body contains a box shape.

var createBox ( var  size)
static

Create a body contains a box shape.

local createBox ( local  size)
static

Create a body contains a box shape.

static PhysicsBody* createCircle ( float  radius)
static

Create a body contains a circle shape.

var createCircle ( var  radius)
static

Create a body contains a circle shape.

local createCircle ( local  radius)
static

Create a body contains a circle shape.

static PhysicsBody* createEdgeBox ( Size  size,
float  border = 1 
)
static

Create a body contains a EdgeBox shape.

var createEdgeBox ( var  size,
var  border = 1 
)
static

Create a body contains a EdgeBox shape.

local createEdgeBox ( local  size,
local  border = 1 
)
static

Create a body contains a EdgeBox shape.

static PhysicsBody* createEdgeChain ( Point points,
int  count,
float  border = 1 
)
static

Create a body contains a EdgeChain shape.

var createEdgeChain ( var  points,
var  count,
var  border = 1 
)
static

Create a body contains a EdgeChain shape.

local createEdgeChain ( local  points,
local  count,
local  border = 1 
)
static

Create a body contains a EdgeChain shape.

static PhysicsBody*
createEdgePolygon
( Point points,
int  count,
float  border = 1 
)
static

Create a body contains a EdgePolygon shape.

var createEdgePolygon ( var  points,
var  count,
var  border = 1 
)
static

Create a body contains a EdgePolygon shape.

local createEdgePolygon ( local  points,
local  count,
local  border = 1 
)
static

Create a body contains a EdgePolygon shape.

static PhysicsBody*
createEdgeSegment
( Point  a,
Point  b,
float  border = 1 
)
static

Create a body contains a EdgeSegment shape.

var createEdgeSegment ( var  a,
var  b,
var  border = 1 
)
static

Create a body contains a EdgeSegment shape.

local createEdgeSegment ( local  a,
local  b,
local  border = 1 
)
static

Create a body contains a EdgeSegment shape.

static PhysicsBody* createPolygon ( Point points,
int  count 
)
static

Create a body contains a polygon shape.

points is an array of Point structs defining a convex hull with a clockwise winding.

var createPolygon ( var  points,
var  count 
)
static

Create a body contains a polygon shape.

points is an array of Point structs defining a convex hull with a clockwise winding.

local createPolygon ( local  points,
local  count 
)
static

Create a body contains a polygon shape.

points is an array of Point structs defining a convex hull with a clockwise winding.

float getAngularDamping ( )
inline
var getAngularDamping ( )
inline
local getAngularDamping ( )
inline
int getCategoryBitmask ( ) const
inline
var getCategoryBitmask ( )
inline
local getCategoryBitmask ( )
inline
int getCollisionBitmask ( ) const
inline
var getCollisionBitmask ( )
inline
local getCollisionBitmask ( )
inline
int getContactTestBitmask ( ) const
inline
var getContactTestBitmask ( )
inline
local getContactTestBitmask ( )
inline
const std::vector<PhysicsJoint*>
* getJoints
( ) const
inline
var getJoints ( )
inline
local getJoints ( )
inline
float getMass ( )
inline
var getMass ( )
inline
local getMass ( )
inline
Sprite* getOwner ( ) const
inline
var getOwner ( )
inline
local getOwner ( )
inline
Point getPosition ( ) const
var getPosition ( )
local getPosition ( )
float getRotation ( ) const
var getRotation ( )
local getRotation ( )
PhysicsShape* getShape ( )
inline
var getShape ( )
inline
local getShape ( )
inline
std::vector<PhysicsShape*>
& getShapes
( )
inline
var getShapes ( )
inline
local getShapes ( )
inline
PhysicsWorld* getWorld ( ) const
inline
var getWorld ( )
inline
local getWorld ( )
inline
bool init ( )
protected
var init ( )
protected
local init ( )
protected
bool initStatic ( )
protected
var initStatic ( )
protected
local initStatic ( )
protected
bool isDynamic ( )
inline
var isDynamic ( )
inline
local isDynamic ( )
inline
void removeAllShapes ( )
var removeAllShapes ( )
local removeAllShapes ( )
void removeShape ( PhysicsShape shape)
var removeShape ( var  shape)
local removeShape ( local  shape)
void setAngularDamping ( float  angularDamping)
var setAngularDamping ( var  angularDamping)
local setAngularDamping ( local  angularDamping)
void setCategoryBitmask ( int  bitmask)
var setCategoryBitmask ( var  bitmask)
local setCategoryBitmask ( local  bitmask)
void setCollisionBitmask ( int  bitmask)
var setCollisionBitmask ( var  bitmask)
local setCollisionBitmask ( local  bitmask)
void setContactTestBitmask ( int  bitmask)
var setContactTestBitmask ( var  bitmask)
local setContactTestBitmask ( local  bitmask)
void setDynamic ( bool  dynamic)
var setDynamic ( var  dynamic)
local setDynamic ( local  dynamic)
void setMass ( float  mass)
var setMass ( var  mass)
local setMass ( local  mass)
virtual void setPosition ( Point  position)
protectedvirtual
var setPosition ( var  position)
protectedvirtual
local setPosition ( local  position)
protectedvirtual
virtual void setRotation ( float  rotation)
protectedvirtual
var setRotation ( var  rotation)
protectedvirtual
local setRotation ( local  rotation)
protectedvirtual

Friends And Related Function Documentation

friend class PhysicsJoint
friend
var PhysicsJoint
friend
local PhysicsJoint
friend
friend class PhysicsShape
friend
var PhysicsShape
friend
local PhysicsShape
friend
friend class PhysicsWorld
friend
var PhysicsWorld
friend
local PhysicsWorld
friend
friend class Sprite
friend
var Sprite
friend
local Sprite
friend

Member Data Documentation

float _angularDamping
protected
var _angularDamping
protected
local _angularDamping
protected
bool _angularDampingDefault
protected
var _angularDampingDefault
protected
local _angularDampingDefault
protected
float _area
protected
var _area
protected
local _area
protected
int _categoryBitmask
protected
var _categoryBitmask
protected
local _categoryBitmask
protected
int _collisionBitmask
protected
var _collisionBitmask
protected
local _collisionBitmask
protected
int _contactTestBitmask
protected
var _contactTestBitmask
protected
local _contactTestBitmask
protected
float _density
protected
var _density
protected
local _density
protected
bool _dynamic
protected
var _dynamic
protected
local _dynamic
protected
PhysicsBodyInfo* _info
protected
var _info
protected
local _info
protected
std::vector<PhysicsJoint*> _joints
protected
var _joints
protected
local _joints
protected
float _mass
protected
var _mass
protected
local _mass
protected
bool _massDefault
protected
var _massDefault
protected
local _massDefault
protected
Sprite* _owner
protected
var _owner
protected
local _owner
protected
std::vector<PhysicsShape*> _shapes
protected
var _shapes
protected
local _shapes
protected
PhysicsWorld* _world
protected
var _world
protected
local _world
protected

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