An PhysicsWorld object simulates collisions and other physical properties. More...
#include <CCPhysicsWorld.h>
Public Member Functions | |
| virtual void | addJoint (PhysicsJoint *joint) |
| Adds a joint to the physics world. More... | |
| var | addJoint ( var joint) |
| Adds a joint to the physics world. More... | |
| local | addJoint ( local joint) |
| Adds a joint to the physics world. More... | |
| virtual void | removeJoint (PhysicsJoint *joint, bool destroy=true) |
| Remove a joint from physics world. More... | |
| local | removeJoint ( local joint, local true) |
| Remove a joint from physics world. More... | |
| virtual void | removeAllJoints (bool destroy=true) |
| Remove all joints from physics world. More... | |
| virtual void | removeBody (PhysicsBody *body) |
| Remove a body from physics world. More... | |
| local | removeBody ( local body) |
| Remove a body from physics world. More... | |
| virtual void | removeBody (int tag) |
| Remove body by tag. More... | |
| local | removeBody ( local tag) |
| Remove body by tag. More... | |
| virtual void | removeAllBodies () |
| Remove all bodies from physics world. More... | |
| var | removeAllBodies () |
| Remove all bodies from physics world. More... | |
| local | removeAllBodies () |
| Remove all bodies from physics world. More... | |
| void | rayCast (PhysicsRayCastCallbackFunc func, const Vec2 &start, const Vec2 &end, void *data) |
| Searches for physics shapes that intersects the ray. More... | |
| var | rayCast ( var func, var start, var end, var data) |
| Searches for physics shapes that intersects the ray. More... | |
| local | rayCast ( local func, local start, local end, local data) |
| Searches for physics shapes that intersects the ray. More... | |
| void | queryRect (PhysicsQueryRectCallbackFunc func, const Rect &rect, void *data) |
| Searches for physics shapes that contains in the rect. More... | |
| void | queryPoint (PhysicsQueryPointCallbackFunc func, const Vec2 &point, void *data) |
| Searches for physics shapes that contains the point. More... | |
| Vector< PhysicsShape * > | getShapes (const Vec2 &point) const |
| Get phsyics shapes that contains the point. More... | |
| PhysicsShape * | getShape (const Vec2 &point) const |
| return physics shape that contains the point. More... | |
| var | getShape ( var point) |
| return physics shape that contains the point. More... | |
| local | getShape ( local point) |
| return physics shape that contains the point. More... | |
| const Vector< PhysicsBody * > & | getAllBodies () const |
| Get all the bodys that in the physics world. More... | |
| var | getAllBodies () |
| Get all the bodys that in the physics world. More... | |
| local | getAllBodies () |
| Get all the bodys that in the physics world. More... | |
| PhysicsBody * | getBody (int tag) const |
| Get body by tag. More... | |
| local | getBody ( local tag) |
| Get body by tag. More... | |
| Scene & | getScene () const |
| Get scene contain this physics world. More... | |
| Vect | getGravity () const |
| get the gravity value More... | |
| void | setGravity (const Vect &gravity) |
| set the gravity value More... | |
| var | setGravity ( var gravity) |
| set the gravity value More... | |
| local | setGravity ( local gravity) |
| set the gravity value More... | |
| void | setSpeed (float speed) |
| Set the speed of physics world, speed is the rate at which the simulation executes. More... | |
| float | getSpeed () |
| get the speed of physics world More... | |
| local | getSpeed () |
| get the speed of physics world More... | |
| void | setUpdateRate (int rate) |
| set the update rate of physics world, update rate is the value of EngineUpdateTimes/PhysicsWorldUpdateTimes. More... | |
| int | getUpdateRate () |
| get the update rate More... | |
| void | setSubsteps (int steps) |
| set the number of substeps in an update of the physics world. More... | |
| var | setSubsteps ( var steps) |
| set the number of substeps in an update of the physics world. More... | |
| local | setSubsteps ( local steps) |
| set the number of substeps in an update of the physics world. More... | |
| int | getSubsteps () const |
| get the number of substeps More... | |
| void | setDebugDrawMask (int mask) |
| set the debug draw mask More... | |
| var | setDebugDrawMask ( var mask) |
| set the debug draw mask More... | |
| local | setDebugDrawMask ( local mask) |
| set the debug draw mask More... | |
| int | getDebugDrawMask () |
| get the bebug draw mask More... | |
| void | setAutoStep (bool autoStep) |
| To control the step of physics, if you want control it by yourself( fixed-timestep for example ), you can set this to false and call step by yourself. More... | |
| bool | isAutoStep () |
| Get the auto step. More... | |
| void | step (float delta) |
| The step for physics world, The times passing for simulate the physics. More... | |
| var | step ( var delta) |
| The step for physics world, The times passing for simulate the physics. More... | |
| local | step ( local delta) |
| The step for physics world, The times passing for simulate the physics. More... | |
Static Public Attributes | |
| static const int | DEBUGDRAW_NONE |
| draw nothing More... | |
| var | DEBUGDRAW_NONE |
| draw nothing More... | |
| local | DEBUGDRAW_NONE |
| draw nothing More... | |
| static const int | DEBUGDRAW_SHAPE |
| draw shapes More... | |
| var | DEBUGDRAW_SHAPE |
| draw shapes More... | |
| local | DEBUGDRAW_SHAPE |
| draw shapes More... | |
| static const int | DEBUGDRAW_JOINT |
| draw joints More... | |
| var | DEBUGDRAW_JOINT |
| draw joints More... | |
| local | DEBUGDRAW_JOINT |
| draw joints More... | |
| static const int | DEBUGDRAW_CONTACT |
| draw contact More... | |
| var | DEBUGDRAW_CONTACT |
| draw contact More... | |
| local | DEBUGDRAW_CONTACT |
| draw contact More... | |
| static const int | DEBUGDRAW_ALL |
| draw all More... | |
| var | DEBUGDRAW_ALL |
| draw all More... | |
| local | DEBUGDRAW_ALL |
| draw all More... | |
Protected Member Functions | |
| bool | init (Scene &scene) |
| local | init ( local scene) |
| virtual void | addBody (PhysicsBody *body) |
| local | addBody ( local body) |
| virtual void | addShape (PhysicsShape *shape) |
| local | addShape ( local shape) |
| virtual void | removeShape (PhysicsShape *shape) |
| local | removeShape ( local shape) |
| virtual void | update (float delta, bool userCall=false) |
| virtual void | debugDraw () |
| var | debugDraw () |
| local | debugDraw () |
| virtual int | collisionBeginCallback (PhysicsContact &contact) |
| local | collisionBeginCallback ( local contact) |
| virtual int | collisionPreSolveCallback (PhysicsContact &contact) |
| local | collisionPreSolveCallback ( local contact) |
| virtual void | collisionPostSolveCallback (PhysicsContact &contact) |
| local | collisionPostSolveCallback ( local contact) |
| virtual void | collisionSeparateCallback (PhysicsContact &contact) |
| local | collisionSeparateCallback ( local contact) |
| virtual void | doAddBody (PhysicsBody *body) |
| local | doAddBody ( local body) |
| virtual void | doRemoveBody (PhysicsBody *body) |
| var | doRemoveBody ( var body) |
| local | doRemoveBody ( local body) |
| virtual void | doRemoveJoint (PhysicsJoint *joint) |
| local | doRemoveJoint ( local joint) |
| virtual void | addBodyOrDelay (PhysicsBody *body) |
| local | addBodyOrDelay ( local body) |
| virtual void | removeBodyOrDelay (PhysicsBody *body) |
| local | removeBodyOrDelay ( local body) |
| virtual void | updateBodies () |
| var | updateBodies () |
| local | updateBodies () |
| virtual void | updateJoints () |
| local | updateJoints () |
| PhysicsWorld () | |
| PhysicsWorld () | |
| virtual | ~PhysicsWorld () |
| local | ~PhysicsWorld () |
Static Protected Member Functions | |
| static PhysicsWorld * | construct (Scene &scene) |
Friends | |
| class | Node |
| class | Sprite |
| class | Scene |
| class | Director |
| class | PhysicsBody |
| class | PhysicsShape |
| class | PhysicsJoint |
| class | PhysicsWorldCallback |
| class | PhysicsDebugDraw |
An PhysicsWorld object simulates collisions and other physical properties.
You do not create PhysicsWorld objects directly; instead, you can get it from an Scene object.
|
protected |
|
protected |
|
protected |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
virtual |
Adds a joint to the physics world.
|
virtual |
Adds a joint to the physics world.
|
virtual |
Adds a joint to the physics world.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
| const Vector<PhysicsBody*> & getAllBodies |
( | ) | const |
Get all the bodys that in the physics world.
| var getAllBodies | ( | ) |
Get all the bodys that in the physics world.
| local getAllBodies | ( | ) |
Get all the bodys that in the physics world.
| PhysicsBody* getBody | ( | int | tag | ) | const |
Get body by tag.
| var getBody | ( | var | tag | ) |
Get body by tag.
| local getBody | ( | local | tag | ) |
Get body by tag.
|
inline |
get the bebug draw mask
|
inline |
get the bebug draw mask
|
inline |
get the bebug draw mask
|
inline |
get the gravity value
|
inline |
get the gravity value
|
inline |
get the gravity value
|
inline |
Get scene contain this physics world.
|
inline |
Get scene contain this physics world.
|
inline |
Get scene contain this physics world.
| PhysicsShape* getShape | ( | const Vec2 & | point | ) | const |
return physics shape that contains the point.
| var getShape | ( | var | point | ) |
return physics shape that contains the point.
| local getShape | ( | local | point | ) |
return physics shape that contains the point.
| Vector<PhysicsShape*> getShapes | ( | const Vec2 & | point | ) | const |
Get phsyics shapes that contains the point.
| var getShapes | ( | var | point | ) |
Get phsyics shapes that contains the point.
| local getShapes | ( | local | point | ) |
Get phsyics shapes that contains the point.
|
inline |
get the speed of physics world
|
inline |
get the speed of physics world
|
inline |
get the speed of physics world
|
inline |
get the number of substeps
|
inline |
get the number of substeps
|
inline |
get the number of substeps
|
inline |
get the update rate
|
inline |
get the update rate
|
inline |
get the update rate
|
protected |
|
protected |
|
protected |
|
inline |
Get the auto step.
|
inline |
Get the auto step.
|
inline |
Get the auto step.
| void queryPoint | ( | PhysicsQueryPointCallbackFunc | func, |
| const Vec2 & | point, | ||
| void * | data | ||
| ) |
Searches for physics shapes that contains the point.
| var queryPoint | ( | var | func, |
| var | point, | ||
| var | data | ||
| ) |
Searches for physics shapes that contains the point.
| local queryPoint | ( | local | func, |
| local | point, | ||
| local | data | ||
| ) |
Searches for physics shapes that contains the point.
| void queryRect | ( | PhysicsQueryRectCallbackFunc | func, |
| const Rect & | rect, | ||
| void * | data | ||
| ) |
Searches for physics shapes that contains in the rect.
| var queryRect | ( | var | func, |
| var | rect, | ||
| var | data | ||
| ) |
Searches for physics shapes that contains in the rect.
| local queryRect | ( | local | func, |
| local | rect, | ||
| local | data | ||
| ) |
Searches for physics shapes that contains in the rect.
| void rayCast | ( | PhysicsRayCastCallbackFunc | func, |
| const Vec2 & | start, | ||
| const Vec2 & | end, | ||
| void * | data | ||
| ) |
Searches for physics shapes that intersects the ray.
| var rayCast | ( | var | func, |
| var | start, | ||
| var | end, | ||
| var | data | ||
| ) |
Searches for physics shapes that intersects the ray.
| local rayCast | ( | local | func, |
| local | start, | ||
| local | end, | ||
| local | data | ||
| ) |
Searches for physics shapes that intersects the ray.
|
virtual |
Remove all bodies from physics world.
|
virtual |
Remove all bodies from physics world.
|
virtual |
Remove all bodies from physics world.
|
virtual |
Remove all joints from physics world.
|
virtual |
Remove all joints from physics world.
|
virtual |
Remove all joints from physics world.
|
virtual |
Remove a body from physics world.
|
virtual |
Remove a body from physics world.
|
virtual |
Remove a body from physics world.
|
virtual |
Remove body by tag.
|
virtual |
Remove body by tag.
|
virtual |
Remove body by tag.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
virtual |
Remove a joint from physics world.
|
virtual |
Remove a joint from physics world.
|
virtual |
Remove a joint from physics world.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
inline |
To control the step of physics, if you want control it by yourself( fixed-timestep for example ), you can set this to false and call step by yourself.
Defaut value is true. Note: if you set auto step to false, setSpeed setSubsteps and setUpdateRate won't work, you need to control the time step by yourself.
|
inline |
To control the step of physics, if you want control it by yourself( fixed-timestep for example ), you can set this to false and call step by yourself.
Defaut value is true. Note: if you set auto step to false, setSpeed setSubsteps and setUpdateRate won't work, you need to control the time step by yourself.
|
inline |
To control the step of physics, if you want control it by yourself( fixed-timestep for example ), you can set this to false and call step by yourself.
Defaut value is true. Note: if you set auto step to false, setSpeed setSubsteps and setUpdateRate won't work, you need to control the time step by yourself.
| void setDebugDrawMask | ( | int | mask | ) |
set the debug draw mask
| var setDebugDrawMask | ( | var | mask | ) |
set the debug draw mask
| local setDebugDrawMask | ( | local | mask | ) |
set the debug draw mask
| void setGravity | ( | const Vect & | gravity | ) |
set the gravity value
| var setGravity | ( | var | gravity | ) |
set the gravity value
| local setGravity | ( | local | gravity | ) |
set the gravity value
|
inline |
Set the speed of physics world, speed is the rate at which the simulation executes.
default value is 1.0 Note: if you setAutoStep(false), this won't work.
|
inline |
Set the speed of physics world, speed is the rate at which the simulation executes.
default value is 1.0 Note: if you setAutoStep(false), this won't work.
|
inline |
Set the speed of physics world, speed is the rate at which the simulation executes.
default value is 1.0 Note: if you setAutoStep(false), this won't work.
| void setSubsteps | ( | int | steps | ) |
set the number of substeps in an update of the physics world.
One physics update will be divided into several substeps to increase its accuracy. default value is 1
| var setSubsteps | ( | var | steps | ) |
set the number of substeps in an update of the physics world.
One physics update will be divided into several substeps to increase its accuracy. default value is 1
| local setSubsteps | ( | local | steps | ) |
set the number of substeps in an update of the physics world.
One physics update will be divided into several substeps to increase its accuracy. default value is 1
|
inline |
set the update rate of physics world, update rate is the value of EngineUpdateTimes/PhysicsWorldUpdateTimes.
set it higher can improve performance, set it lower can improve accuracy of physics world simulation. default value is 1.0 Note: if you setAutoStep(false), this won't work.
|
inline |
set the update rate of physics world, update rate is the value of EngineUpdateTimes/PhysicsWorldUpdateTimes.
set it higher can improve performance, set it lower can improve accuracy of physics world simulation. default value is 1.0 Note: if you setAutoStep(false), this won't work.
|
inline |
set the update rate of physics world, update rate is the value of EngineUpdateTimes/PhysicsWorldUpdateTimes.
set it higher can improve performance, set it lower can improve accuracy of physics world simulation. default value is 1.0 Note: if you setAutoStep(false), this won't work.
| void step | ( | float | delta | ) |
The step for physics world, The times passing for simulate the physics.
Note: you need to setAutoStep(false) first before it can work.
| var step | ( | var | delta | ) |
The step for physics world, The times passing for simulate the physics.
Note: you need to setAutoStep(false) first before it can work.
| local step | ( | local | delta | ) |
The step for physics world, The times passing for simulate the physics.
Note: you need to setAutoStep(false) first before it can work.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
draw all
|
static |
draw all
|
static |
draw all
|
static |
draw contact
|
static |
draw contact
|
static |
draw contact
|
static |
draw joints
|
static |
draw joints
|
static |
draw joints
|
static |
draw nothing
|
static |
draw nothing
|
static |
draw nothing
|
static |
draw shapes
|
static |
draw shapes
|
static |
draw shapes