A body affect by physics. More...
#include <CCPhysicsBody.h>
Public Member Functions | |
virtual PhysicsShape * | addShape (PhysicsShape *shape, bool addMassAndMoment=true) |
void | removeShape (PhysicsShape *shape, bool reduceMassAndMoment=true) |
void | removeShape (int tag, bool reduceMassAndMoment=true) |
void | removeAllShapes (bool reduceMassAndMoment=true) |
const Vector< PhysicsShape * > & | getShapes () const |
PhysicsShape * | getFirstShape () const |
PhysicsShape * | getShape (int tag) const |
local | getShape ( local tag) |
virtual void | applyForce (const Vect &force) |
Applies a immediate force to body. More... | |
local | applyForce ( local force) |
Applies a immediate force to body. More... | |
virtual void | applyForce (const Vect &force, const Vec2 &offset) |
Applies a immediate force to body. More... | |
virtual void | resetForces () |
reset all the force applied to body. More... | |
virtual void | applyImpulse (const Vect &impulse) |
Applies a continuous force to body. More... | |
local | applyImpulse ( local impulse) |
Applies a continuous force to body. More... | |
virtual void | applyImpulse (const Vect &impulse, const Vec2 &offset) |
Applies a continuous force to body. More... | |
virtual void | applyTorque (float torque) |
Applies a torque force to body. More... | |
virtual void | setVelocity (const Vect &velocity) |
set the velocity of a body More... | |
virtual Vec2 | getVelocity () |
get the velocity of a body More... | |
virtual void | setAngularVelocity (float velocity) |
set the angular velocity of a body More... | |
local | setAngularVelocity ( local velocity) |
set the angular velocity of a body More... | |
virtual Vec2 | getVelocityAtLocalPoint (const Vec2 &point) |
get the angular velocity of a body at a local point More... | |
local | getVelocityAtLocalPoint ( local point) |
get the angular velocity of a body at a local point More... | |
virtual Vec2 | getVelocityAtWorldPoint (const Vec2 &point) |
get the angular velocity of a body at a world point More... | |
var | getVelocityAtWorldPoint ( var point) |
get the angular velocity of a body at a world point More... | |
local | getVelocityAtWorldPoint ( local point) |
get the angular velocity of a body at a world point More... | |
virtual float | getAngularVelocity () |
get the angular velocity of a body More... | |
virtual void | setVelocityLimit (float limit) |
set the max of velocity More... | |
var | setVelocityLimit ( var limit) |
set the max of velocity More... | |
local | setVelocityLimit ( local limit) |
set the max of velocity More... | |
virtual float | getVelocityLimit () |
get the max of velocity More... | |
virtual void | setAngularVelocityLimit (float limit) |
set the max of angular velocity More... | |
virtual float | getAngularVelocityLimit () |
get the max of angular velocity More... | |
void | removeFromWorld () |
remove the body from the world it added to More... | |
PhysicsWorld * | getWorld () const |
get the world body added to. More... | |
const std::vector < PhysicsJoint * > & | getJoints () const |
get all joints the body have More... | |
local | getJoints () |
get all joints the body have More... | |
Node * | getNode () const |
get the sprite the body set to. More... | |
local | getNode () |
get the sprite the body set to. More... | |
void | setCategoryBitmask (int bitmask) |
A mask that defines which categories this physics body belongs to. More... | |
void | setContactTestBitmask (int bitmask) |
A mask that defines which categories of bodies cause intersection notifications with this physics body. More... | |
void | setCollisionBitmask (int bitmask) |
A mask that defines which categories of physics bodies can collide with this physics body. More... | |
int | getCategoryBitmask () const |
get the category bit mask More... | |
int | getContactTestBitmask () const |
get the contact test bit mask More... | |
int | getCollisionBitmask () const |
get the collision bit mask More... | |
void | setGroup (int group) |
set the group of body Collision groups let you specify an integral group index. More... | |
int | getGroup () const |
get the group of body More... | |
Vec2 | getPosition () const |
get the body position. More... | |
float | getRotation () const |
get the body rotation. More... | |
void | setPositionOffset (const Vec2 &position) |
set body position offset, it's the position witch relative to node More... | |
var | setPositionOffset ( var position) |
set body position offset, it's the position witch relative to node More... | |
local | setPositionOffset ( local position) |
set body position offset, it's the position witch relative to node More... | |
Vec2 | getPositionOffset () const |
get body position offset. More... | |
void | setRotationOffset (float rotation) |
set body rotation offset, it's the rotation witch relative to node More... | |
float | getRotationOffset () const |
set the body rotation offset More... | |
bool | isDynamic () const |
test the body is dynamic or not. More... | |
void | setDynamic (bool dynamic) |
set dynamic to body. More... | |
void | setMass (float mass) |
set the body mass. More... | |
float | getMass () const |
get the body mass. More... | |
void | addMass (float mass) |
add mass to body. More... | |
local | addMass ( local mass) |
add mass to body. More... | |
void | setMoment (float moment) |
set the body moment of inertia. More... | |
float | getMoment () const |
get the body moment of inertia. More... | |
void | addMoment (float moment) |
add moment of inertia to body. More... | |
local | addMoment ( local moment) |
add moment of inertia to body. More... | |
float | getLinearDamping () const |
get linear damping. More... | |
void | setLinearDamping (float damping) |
set linear damping. More... | |
float | getAngularDamping () const |
get angular damping. More... | |
void | setAngularDamping (float damping) |
set angular damping. More... | |
bool | isResting () const |
whether the body is at rest More... | |
void | setResting (bool rest) const |
set body to rest More... | |
local | setResting ( local rest) |
set body to rest More... | |
bool | isEnabled () const |
whether the body is enabled if the body it isn't enabled, it will not has simulation by world More... | |
void | setEnable (bool enable) |
set the enable value. More... | |
bool | isRotationEnabled () const |
whether the body can rotation More... | |
void | setRotationEnable (bool enable) |
set the body is allow rotation or not More... | |
bool | isGravityEnabled () const |
whether this physics body is affected by the physics world’s gravitational force. More... | |
void | setGravityEnable (bool enable) |
set the body is affected by the physics world's gravitational force or not. More... | |
int | getTag () const |
get the body's tag More... | |
void | setTag (int tag) |
set the body's tag More... | |
Vec2 | world2Local (const Vec2 &point) |
convert the world point to local More... | |
Vec2 | local2World (const Vec2 &point) |
convert the local point to world More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
Static Public Member Functions | |
static PhysicsBody * | create () |
create a body with defult mass and moment. More... | |
static PhysicsBody * | create (float mass) |
create a body with mass and defult moment. More... | |
var | create ( var mass) |
create a body with mass and defult moment. More... | |
local | create ( local mass) |
create a body with mass and defult moment. More... | |
static PhysicsBody * | create (float mass, float moment) |
create a body with mass and moment. More... | |
static PhysicsBody * | createCircle (float radius, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, const Vec2 &offset=Vec2::ZERO) |
Create a body contains a circle shape. More... | |
var | createCircle ( var radius, var PHYSICSBODY_MATERIAL_DEFAULT, var ZERO) |
Create a body contains a circle shape. More... | |
local | createCircle ( local radius, local PHYSICSBODY_MATERIAL_DEFAULT, local ZERO) |
Create a body contains a circle shape. More... | |
static PhysicsBody * | createBox (const Size &size, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, const Vec2 &offset=Vec2::ZERO) |
Create a body contains a box shape. More... | |
static PhysicsBody * | createPolygon (const Vec2 *points, int count, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, const Vec2 &offset=Vec2::ZERO) |
Create a body contains a polygon shape. More... | |
static PhysicsBody * | createEdgeSegment (const Vec2 &a, const Vec2 &b, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, float border=1) |
Create a body contains a EdgeSegment shape. More... | |
var | createEdgeSegment ( var a, var b, var PHYSICSBODY_MATERIAL_DEFAULT, var 1) |
Create a body contains a EdgeSegment shape. More... | |
local | createEdgeSegment ( local a, local b, local PHYSICSBODY_MATERIAL_DEFAULT, local 1) |
Create a body contains a EdgeSegment shape. More... | |
static PhysicsBody * | createEdgeBox (const Size &size, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, float border=1, const Vec2 &offset=Vec2::ZERO) |
Create a body contains a EdgeBox shape. More... | |
static PhysicsBody * | createEdgePolygon (const Vec2 *points, int count, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, float border=1) |
Create a body contains a EdgePolygon shape. More... | |
local | createEdgePolygon ( local points, local count, local PHYSICSBODY_MATERIAL_DEFAULT, local 1) |
Create a body contains a EdgePolygon shape. More... | |
static PhysicsBody * | createEdgeChain (const Vec2 *points, int count, const PhysicsMaterial &material=PHYSICSBODY_MATERIAL_DEFAULT, float border=1) |
Create a body contains a EdgeChain shape. More... | |
Protected Member Functions | |
bool | init () |
virtual void | setPosition (Vec2 position) |
local | setPosition ( local position) |
virtual void | setRotation (float rotation) |
local | setRotation ( local rotation) |
void | update (float delta) |
void | removeJoint (PhysicsJoint *joint) |
local | removeJoint ( local joint) |
void | updateDamping () |
void | updateMass (float oldMass, float newMass) |
local | updateMass ( local oldMass, local newMass) |
PhysicsBody () | |
virtual | ~PhysicsBody () |
Protected Member Functions inherited from Ref | |
Ref () | |
Constructor. More... | |
Ref () | |
Constructor. More... | |
Protected Attributes | |
Node * | _node |
std::vector< PhysicsJoint * > | _joints |
var | _joints |
local | _joints |
Vector< PhysicsShape * > | _shapes |
var | _shapes |
local | _shapes |
PhysicsWorld * | _world |
PhysicsBodyInfo * | _info |
bool | _dynamic |
bool | _enabled |
bool | _rotationEnabled |
bool | _gravityEnabled |
bool | _massDefault |
bool | _momentDefault |
float | _mass |
float | _area |
float | _density |
float | _moment |
bool | _isDamping |
float | _linearDamping |
float | _angularDamping |
int | _tag |
int | _categoryBitmask |
int | _collisionBitmask |
int | _contactTestBitmask |
int | _group |
bool | _positionResetTag |
bool | _rotationResetTag |
To avoid reset the body position when body invoke Node::setPosition(). More... | |
Vec2 | _positionOffset |
To avoid reset the body rotation when body invoke Node::setRotation(). More... | |
float | _rotationOffset |
Protected Attributes inherited from Ref | |
unsigned int | _referenceCount |
count of references More... | |
local | _referenceCount |
count of references More... | |
Friends | |
class | PhysicsWorld |
class | PhysicsShape |
class | PhysicsJoint |
class | Node |
class | Layer |
class | ProtectedNode |
A body affect by physics.
it can attach one or more shapes. if you create body with createXXX, it will automatically compute mass and moment with density your specified(which is PHYSICSBODY_MATERIAL_DEFAULT by default, and the density value is 0.1f), and it based on the formular: mass = density * area. if you create body with createEdgeXXX, the mass and moment will be PHYSICS_INFINITY by default. and it's a static body. you can change mass and moment with setMass() and setMoment(). and you can change the body to be dynamic or static by use function setDynamic().
|
protected |
|
protected |
|
protected |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
void addMass | ( | float | mass | ) |
add mass to body.
if _mass(mass of the body) == PHYSICS_INFINITY, it remains. if mass == PHYSICS_INFINITY, _mass will be PHYSICS_INFINITY. if mass == -PHYSICS_INFINITY, _mass will not change. if mass + _mass <= 0, _mass will equal to MASS_DEFAULT(1.0) other wise, mass = mass + _mass;
var addMass | ( | var | mass | ) |
add mass to body.
if _mass(mass of the body) == PHYSICS_INFINITY, it remains. if mass == PHYSICS_INFINITY, _mass will be PHYSICS_INFINITY. if mass == -PHYSICS_INFINITY, _mass will not change. if mass + _mass <= 0, _mass will equal to MASS_DEFAULT(1.0) other wise, mass = mass + _mass;
local addMass | ( | local | mass | ) |
add mass to body.
if _mass(mass of the body) == PHYSICS_INFINITY, it remains. if mass == PHYSICS_INFINITY, _mass will be PHYSICS_INFINITY. if mass == -PHYSICS_INFINITY, _mass will not change. if mass + _mass <= 0, _mass will equal to MASS_DEFAULT(1.0) other wise, mass = mass + _mass;
void addMoment | ( | float | moment | ) |
add moment of inertia to body.
if _moment(moment of the body) == PHYSICS_INFINITY, it remains. if moment == PHYSICS_INFINITY, _moment will be PHYSICS_INFINITY. if moment == -PHYSICS_INFINITY, _moment will not change. if moment + _moment <= 0, _moment will equal to MASS_DEFAULT(1.0) other wise, moment = moment + _moment;
var addMoment | ( | var | moment | ) |
add moment of inertia to body.
if _moment(moment of the body) == PHYSICS_INFINITY, it remains. if moment == PHYSICS_INFINITY, _moment will be PHYSICS_INFINITY. if moment == -PHYSICS_INFINITY, _moment will not change. if moment + _moment <= 0, _moment will equal to MASS_DEFAULT(1.0) other wise, moment = moment + _moment;
local addMoment | ( | local | moment | ) |
add moment of inertia to body.
if _moment(moment of the body) == PHYSICS_INFINITY, it remains. if moment == PHYSICS_INFINITY, _moment will be PHYSICS_INFINITY. if moment == -PHYSICS_INFINITY, _moment will not change. if moment + _moment <= 0, _moment will equal to MASS_DEFAULT(1.0) other wise, moment = moment + _moment;
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Applies a immediate force to body.
|
virtual |
Applies a immediate force to body.
|
virtual |
Applies a immediate force to body.
Applies a immediate force to body.
|
virtual |
Applies a immediate force to body.
|
virtual |
Applies a immediate force to body.
|
virtual |
Applies a continuous force to body.
|
virtual |
Applies a continuous force to body.
|
virtual |
Applies a continuous force to body.
Applies a continuous force to body.
|
virtual |
Applies a continuous force to body.
|
virtual |
Applies a continuous force to body.
|
virtual |
Applies a torque force to body.
|
virtual |
Applies a torque force to body.
|
virtual |
Applies a torque force to body.
|
static |
create a body with defult mass and moment.
|
static |
create a body with defult mass and moment.
|
static |
create a body with defult mass and moment.
|
static |
create a body with mass and defult moment.
|
static |
create a body with mass and defult moment.
|
static |
create a body with mass and defult moment.
|
static |
create a body with mass and moment.
|
static |
create a body with mass and moment.
|
static |
create a body with mass and moment.
|
static |
Create a body contains a box shape.
|
static |
Create a body contains a box shape.
|
static |
Create a body contains a box shape.
|
static |
Create a body contains a circle shape.
|
static |
Create a body contains a circle shape.
|
static |
Create a body contains a circle shape.
|
static |
Create a body contains a EdgeBox shape.
|
static |
Create a body contains a EdgeBox shape.
|
static |
Create a body contains a EdgeBox shape.
|
static |
Create a body contains a EdgeChain shape.
|
static |
Create a body contains a EdgeChain shape.
|
static |
Create a body contains a EdgeChain shape.
|
static |
Create a body contains a EdgePolygon shape.
|
static |
Create a body contains a EdgePolygon shape.
|
static |
Create a body contains a EdgePolygon shape.
|
static |
Create a body contains a EdgeSegment shape.
|
static |
Create a body contains a EdgeSegment shape.
|
static |
Create a body contains a EdgeSegment shape.
|
static |
Create a body contains a polygon shape.
points is an array of Vec2 structs defining a convex hull with a clockwise winding.
|
static |
Create a body contains a polygon shape.
points is an array of Vec2 structs defining a convex hull with a clockwise winding.
|
static |
Create a body contains a polygon shape.
points is an array of Vec2 structs defining a convex hull with a clockwise winding.
|
inline |
get angular damping.
|
inline |
get angular damping.
|
inline |
get angular damping.
|
virtual |
get the angular velocity of a body
|
virtual |
get the angular velocity of a body
|
virtual |
get the angular velocity of a body
|
virtual |
get the max of angular velocity
|
virtual |
get the max of angular velocity
|
virtual |
get the max of angular velocity
|
inline |
get the category bit mask
|
inline |
get the category bit mask
|
inline |
get the category bit mask
|
inline |
get the collision bit mask
|
inline |
get the collision bit mask
|
inline |
get the collision bit mask
|
inline |
get the contact test bit mask
|
inline |
get the contact test bit mask
|
inline |
get the contact test bit mask
|
inline |
|
inline |
|
inline |
|
inline |
get the group of body
|
inline |
get the group of body
|
inline |
get the group of body
|
inline |
get all joints the body have
|
inline |
get all joints the body have
|
inline |
get all joints the body have
|
inline |
get linear damping.
|
inline |
get linear damping.
|
inline |
get linear damping.
|
inline |
get the body mass.
|
inline |
get the body mass.
|
inline |
get the body mass.
|
inline |
get the body moment of inertia.
|
inline |
get the body moment of inertia.
|
inline |
get the body moment of inertia.
|
inline |
get the sprite the body set to.
|
inline |
get the sprite the body set to.
|
inline |
get the sprite the body set to.
Vec2 getPosition | ( | ) | const |
get the body position.
var getPosition | ( | ) |
get the body position.
local getPosition | ( | ) |
get the body position.
Vec2 getPositionOffset | ( | ) | const |
get body position offset.
var getPositionOffset | ( | ) |
get body position offset.
local getPositionOffset | ( | ) |
get body position offset.
float getRotation | ( | ) | const |
get the body rotation.
var getRotation | ( | ) |
get the body rotation.
local getRotation | ( | ) |
get the body rotation.
float getRotationOffset | ( | ) | const |
set the body rotation offset
var getRotationOffset | ( | ) |
set the body rotation offset
local getRotationOffset | ( | ) |
set the body rotation offset
PhysicsShape* getShape | ( | int | tag | ) | const |
var getShape | ( | var | tag | ) |
local getShape | ( | local | tag | ) |
|
inline |
|
inline |
|
inline |
|
inline |
get the body's tag
|
inline |
get the body's tag
|
inline |
get the body's tag
|
virtual |
get the velocity of a body
|
virtual |
get the velocity of a body
|
virtual |
get the velocity of a body
get the angular velocity of a body at a local point
|
virtual |
get the angular velocity of a body at a local point
|
virtual |
get the angular velocity of a body at a local point
get the angular velocity of a body at a world point
|
virtual |
get the angular velocity of a body at a world point
|
virtual |
get the angular velocity of a body at a world point
|
virtual |
get the max of velocity
|
virtual |
get the max of velocity
|
virtual |
get the max of velocity
|
inline |
get the world body added to.
|
inline |
get the world body added to.
|
inline |
get the world body added to.
|
protected |
|
protected |
|
protected |
|
inline |
test the body is dynamic or not.
a dynamic body will effect with gravity.
|
inline |
test the body is dynamic or not.
a dynamic body will effect with gravity.
|
inline |
test the body is dynamic or not.
a dynamic body will effect with gravity.
|
inline |
whether the body is enabled if the body it isn't enabled, it will not has simulation by world
|
inline |
whether the body is enabled if the body it isn't enabled, it will not has simulation by world
|
inline |
whether the body is enabled if the body it isn't enabled, it will not has simulation by world
|
inline |
whether this physics body is affected by the physics world’s gravitational force.
|
inline |
whether this physics body is affected by the physics world’s gravitational force.
|
inline |
whether this physics body is affected by the physics world’s gravitational force.
bool isResting | ( | ) | const |
whether the body is at rest
var isResting | ( | ) |
whether the body is at rest
local isResting | ( | ) |
whether the body is at rest
|
inline |
whether the body can rotation
|
inline |
whether the body can rotation
|
inline |
whether the body can rotation
var local2World | ( | var | point | ) |
convert the local point to world
local local2World | ( | local | point | ) |
convert the local point to world
void removeAllShapes | ( | bool | reduceMassAndMoment = true | ) |
var removeAllShapes | ( | var | reduceMassAndMoment = true | ) |
local removeAllShapes | ( | local | reduceMassAndMoment = true | ) |
void removeFromWorld | ( | ) |
remove the body from the world it added to
var removeFromWorld | ( | ) |
remove the body from the world it added to
local removeFromWorld | ( | ) |
remove the body from the world it added to
|
protected |
|
protected |
|
protected |
void removeShape | ( | PhysicsShape * | shape, |
bool | reduceMassAndMoment = true |
||
) |
var removeShape | ( | var | shape, |
var | reduceMassAndMoment = true |
||
) |
local removeShape | ( | local | shape, |
local | reduceMassAndMoment = true |
||
) |
void removeShape | ( | int | tag, |
bool | reduceMassAndMoment = true |
||
) |
var removeShape | ( | var | tag, |
var | reduceMassAndMoment = true |
||
) |
local removeShape | ( | local | tag, |
local | reduceMassAndMoment = true |
||
) |
|
virtual |
reset all the force applied to body.
|
virtual |
reset all the force applied to body.
|
virtual |
reset all the force applied to body.
|
inline |
set angular damping.
it is used to simulate fluid or air friction forces on the body. the value is 0.0f to 1.0f.
|
inline |
set angular damping.
it is used to simulate fluid or air friction forces on the body. the value is 0.0f to 1.0f.
|
inline |
set angular damping.
it is used to simulate fluid or air friction forces on the body. the value is 0.0f to 1.0f.
|
virtual |
set the angular velocity of a body
|
virtual |
set the angular velocity of a body
|
virtual |
set the angular velocity of a body
|
virtual |
set the max of angular velocity
|
virtual |
set the max of angular velocity
|
virtual |
set the max of angular velocity
void setCategoryBitmask | ( | int | bitmask | ) |
A mask that defines which categories this physics body belongs to.
Every physics body in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. You define the mask values used in your game. In conjunction with the collisionBitMask and contactTestBitMask properties, you define which physics bodies interact with each other and when your game is notified of these interactions. The default value is 0xFFFFFFFF (all bits set).
var setCategoryBitmask | ( | var | bitmask | ) |
A mask that defines which categories this physics body belongs to.
Every physics body in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. You define the mask values used in your game. In conjunction with the collisionBitMask and contactTestBitMask properties, you define which physics bodies interact with each other and when your game is notified of these interactions. The default value is 0xFFFFFFFF (all bits set).
local setCategoryBitmask | ( | local | bitmask | ) |
A mask that defines which categories this physics body belongs to.
Every physics body in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. You define the mask values used in your game. In conjunction with the collisionBitMask and contactTestBitMask properties, you define which physics bodies interact with each other and when your game is notified of these interactions. The default value is 0xFFFFFFFF (all bits set).
void setCollisionBitmask | ( | int | bitmask | ) |
A mask that defines which categories of physics bodies can collide with this physics body.
When two physics bodies contact each other, a collision may occur. This body’s collision mask is compared to the other body’s category mask by performing a logical AND operation. If the result is a non-zero value, then this body is affected by the collision. Each body independently chooses whether it wants to be affected by the other body. For example, you might use this to avoid collision calculations that would make negligible changes to a body’s velocity. The default value is 0xFFFFFFFF (all bits set).
var setCollisionBitmask | ( | var | bitmask | ) |
A mask that defines which categories of physics bodies can collide with this physics body.
When two physics bodies contact each other, a collision may occur. This body’s collision mask is compared to the other body’s category mask by performing a logical AND operation. If the result is a non-zero value, then this body is affected by the collision. Each body independently chooses whether it wants to be affected by the other body. For example, you might use this to avoid collision calculations that would make negligible changes to a body’s velocity. The default value is 0xFFFFFFFF (all bits set).
local setCollisionBitmask | ( | local | bitmask | ) |
A mask that defines which categories of physics bodies can collide with this physics body.
When two physics bodies contact each other, a collision may occur. This body’s collision mask is compared to the other body’s category mask by performing a logical AND operation. If the result is a non-zero value, then this body is affected by the collision. Each body independently chooses whether it wants to be affected by the other body. For example, you might use this to avoid collision calculations that would make negligible changes to a body’s velocity. The default value is 0xFFFFFFFF (all bits set).
void setContactTestBitmask | ( | int | bitmask | ) |
A mask that defines which categories of bodies cause intersection notifications with this physics body.
When two bodies share the same space, each body’s category mask is tested against the other body’s contact mask by performing a logical AND operation. If either comparison results in a non-zero value, an PhysicsContact object is created and passed to the physics world’s delegate. For best performance, only set bits in the contacts mask for interactions you are interested in. The default value is 0x00000000 (all bits cleared).
var setContactTestBitmask | ( | var | bitmask | ) |
A mask that defines which categories of bodies cause intersection notifications with this physics body.
When two bodies share the same space, each body’s category mask is tested against the other body’s contact mask by performing a logical AND operation. If either comparison results in a non-zero value, an PhysicsContact object is created and passed to the physics world’s delegate. For best performance, only set bits in the contacts mask for interactions you are interested in. The default value is 0x00000000 (all bits cleared).
local setContactTestBitmask | ( | local | bitmask | ) |
A mask that defines which categories of bodies cause intersection notifications with this physics body.
When two bodies share the same space, each body’s category mask is tested against the other body’s contact mask by performing a logical AND operation. If either comparison results in a non-zero value, an PhysicsContact object is created and passed to the physics world’s delegate. For best performance, only set bits in the contacts mask for interactions you are interested in. The default value is 0x00000000 (all bits cleared).
void setDynamic | ( | bool | dynamic | ) |
set dynamic to body.
a dynamic body will effect with gravity.
var setDynamic | ( | var | dynamic | ) |
set dynamic to body.
a dynamic body will effect with gravity.
local setDynamic | ( | local | dynamic | ) |
set dynamic to body.
a dynamic body will effect with gravity.
void setEnable | ( | bool | enable | ) |
set the enable value.
if the body it isn't enabled, it will not has simulation by world
var setEnable | ( | var | enable | ) |
set the enable value.
if the body it isn't enabled, it will not has simulation by world
local setEnable | ( | local | enable | ) |
set the enable value.
if the body it isn't enabled, it will not has simulation by world
void setGravityEnable | ( | bool | enable | ) |
set the body is affected by the physics world's gravitational force or not.
var setGravityEnable | ( | var | enable | ) |
set the body is affected by the physics world's gravitational force or not.
local setGravityEnable | ( | local | enable | ) |
set the body is affected by the physics world's gravitational force or not.
void setGroup | ( | int | group | ) |
set the group of body Collision groups let you specify an integral group index.
You can have all fixtures with the same group index always collide (positive index) or never collide (negative index) it have high priority than bit masks
var setGroup | ( | var | group | ) |
set the group of body Collision groups let you specify an integral group index.
You can have all fixtures with the same group index always collide (positive index) or never collide (negative index) it have high priority than bit masks
local setGroup | ( | local | group | ) |
set the group of body Collision groups let you specify an integral group index.
You can have all fixtures with the same group index always collide (positive index) or never collide (negative index) it have high priority than bit masks
|
inline |
set linear damping.
it is used to simulate fluid or air friction forces on the body. the value is 0.0f to 1.0f.
|
inline |
set linear damping.
it is used to simulate fluid or air friction forces on the body. the value is 0.0f to 1.0f.
|
inline |
set linear damping.
it is used to simulate fluid or air friction forces on the body. the value is 0.0f to 1.0f.
void setMass | ( | float | mass | ) |
var setMass | ( | var | mass | ) |
local setMass | ( | local | mass | ) |
void setMoment | ( | float | moment | ) |
set the body moment of inertia.
var setMoment | ( | var | moment | ) |
set the body moment of inertia.
local setMoment | ( | local | moment | ) |
set the body moment of inertia.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
void setPositionOffset | ( | const Vec2 & | position | ) |
set body position offset, it's the position witch relative to node
var setPositionOffset | ( | var | position | ) |
set body position offset, it's the position witch relative to node
local setPositionOffset | ( | local | position | ) |
set body position offset, it's the position witch relative to node
void setResting | ( | bool | rest | ) | const |
set body to rest
var setResting | ( | var | rest | ) |
set body to rest
local setResting | ( | local | rest | ) |
set body to rest
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
void setRotationEnable | ( | bool | enable | ) |
set the body is allow rotation or not
var setRotationEnable | ( | var | enable | ) |
set the body is allow rotation or not
local setRotationEnable | ( | local | enable | ) |
set the body is allow rotation or not
void setRotationOffset | ( | float | rotation | ) |
set body rotation offset, it's the rotation witch relative to node
var setRotationOffset | ( | var | rotation | ) |
set body rotation offset, it's the rotation witch relative to node
local setRotationOffset | ( | local | rotation | ) |
set body rotation offset, it's the rotation witch relative to node
|
inline |
set the body's tag
|
inline |
set the body's tag
|
inline |
set the body's tag
|
virtual |
set the velocity of a body
|
virtual |
set the velocity of a body
|
virtual |
set the velocity of a body
|
virtual |
set the max of velocity
|
virtual |
set the max of velocity
|
virtual |
set the max of velocity
|
protected |
|
protected |
|
protected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
|
protected |
|
protected |
var world2Local | ( | var | point | ) |
convert the world point to local
local world2Local | ( | local | point | ) |
convert the world point to local
|
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 |
|
protected |
|
protected |
|
protected |
|
protected |
To avoid reset the body rotation when body invoke Node::setRotation().
|
protected |
To avoid reset the body rotation when body invoke Node::setRotation().
|
protected |
To avoid reset the body rotation when body invoke Node::setRotation().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
To avoid reset the body position when body invoke Node::setPosition().
|
protected |
To avoid reset the body position when body invoke Node::setPosition().
|
protected |
To avoid reset the body position when body invoke Node::setPosition().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |