A shape for body. More...
Inherits Ref.
Inherited by PhysicsShapeCircle, PhysicsShapeEdgeChain, PhysicsShapeEdgePolygon, PhysicsShapeEdgeSegment, and PhysicsShapePolygon.
Public Types | |
enum | Type { , POLYGEN = POLYGON, EDGEPOLYGEN = EDGEPOLYGON } |
Public Member Functions | |
PhysicsBody * | getBody () const |
Get the body that this shape attaches. More... | |
var | getBody () |
Get the body that this shape attaches. More... | |
local | getBody () |
Get the body that this shape attaches. More... | |
Type | getType () const |
Return this shape's type. More... | |
local | getType () |
Return this shape's type. More... | |
float | getArea () const |
Return this shape's area. More... | |
local | getArea () |
Return this shape's area. More... | |
float | getMoment () const |
Get this shape's moment. More... | |
local | getMoment () |
Get this shape's moment. More... | |
void | setMoment (float moment) |
Set this shape's moment. More... | |
void | setTag (int tag) |
Set this shape's tag. More... | |
int | getTag () const |
Get this shape's tag. More... | |
local | getTag () |
Get this shape's tag. More... | |
float | getMass () const |
Get the mass of this shape. More... | |
local | getMass () |
Get the mass of this shape. More... | |
void | setMass (float mass) |
Set this shape's mass. More... | |
float | getDensity () const |
Get this shape's density. More... | |
var | getDensity () |
Get this shape's density. More... | |
local | getDensity () |
Get this shape's density. More... | |
void | setDensity (float density) |
Set this shape's density. More... | |
float | getRestitution () const |
Get this shape's restitution. More... | |
void | setRestitution (float restitution) |
Set this shape's restitution. More... | |
float | getFriction () const |
Get this shape's friction. More... | |
void | setFriction (float friction) |
Set this shape's friction. More... | |
const PhysicsMaterial & | getMaterial () const |
Get this shape's PhysicsMaterial object. More... | |
local | getMaterial () |
Get this shape's PhysicsMaterial object. More... | |
void | setMaterial (const PhysicsMaterial &material) |
Set this shape's material. More... | |
local | setMaterial ( local material) |
Set this shape's material. More... | |
virtual float | calculateDefaultMoment () |
Calculate the default moment value. More... | |
virtual Vec2 | getOffset () |
Get this shape's position offset. More... | |
var | getOffset () |
Get this shape's position offset. More... | |
local | getOffset () |
Get this shape's position offset. More... | |
virtual Vec2 | getCenter () |
Get this shape's center position. More... | |
var | getCenter () |
Get this shape's center position. More... | |
local | getCenter () |
Get this shape's center position. More... | |
bool | containsPoint (const Vec2 &point) const |
Test point is inside this shape or not. More... | |
local | containsPoint ( local point) |
Test point is inside this shape or not. More... | |
void | setCategoryBitmask (int bitmask) |
Set a mask that defines which categories this physics body belongs to. More... | |
int | getCategoryBitmask () const |
Get 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... | |
int | getContactTestBitmask () const |
Get 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... | |
local | setCollisionBitmask ( local bitmask) |
A mask that defines which categories of physics bodies can collide with this physics body. More... | |
int | getCollisionBitmask () const |
Get a mask that defines which categories of physics bodies can collide with this physics body. More... | |
void | setGroup (int group) |
Set the group of body. More... | |
int | getGroup () |
Get the group of body. More... | |
var | getGroup () |
Get the group of body. More... | |
local | getGroup () |
Get the group of body. More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
local | 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... | |
local | getReferenceCount () |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
Destructor. More... | |
Static Public Member Functions | |
static void | recenterPoints (Vec2 *points, int count, const Vec2 ¢er=Vec2::ZERO) |
Move the points to the center. More... | |
var | recenterPoints ( var points, var count, var ZERO) |
Move the points to the center. More... | |
local | recenterPoints ( local points, local count, local ZERO) |
Move the points to the center. More... | |
static Vec2 | getPolygonCenter (const Vec2 *points, int count) |
Get center of the polygon points. More... | |
local | getPolygonCenter ( local points, local count) |
Get center of the polygon points. More... | |
static Vec2 | getPolyonCenter (const Vec2 *points, int count) |
local | getPolyonCenter ( local points, local count) |
Additional Inherited Members | |
Public Attributes inherited from Ref | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
local | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
local | _luaID |
Lua reference id. | |
void * | _scriptObject |
scriptObject, support for swift | |
local | _scriptObject |
scriptObject, support for swift | |
bool | _rooted |
When true, it means that the object was already rooted. | |
local | _rooted |
When true, it means that the object was already rooted. | |
A shape for body.
You do not create PhysicsWorld objects directly, instead, you can view PhysicsBody to see how to create it.
|
inline |
Get the body that this shape attaches.
|
inline |
Get the body that this shape attaches.
|
inline |
Get the body that this shape attaches.
|
inline |
Return this shape's type.
|
inline |
Return this shape's type.
|
inline |
Return this shape's type.
|
inline |
Return this shape's area.
|
inline |
Return this shape's area.
|
inline |
Return this shape's area.
|
inline |
Get this shape's moment.
|
inline |
Get this shape's moment.
|
inline |
Get this shape's moment.
void setMoment | ( | float | moment | ) |
Set this shape's moment.
It will change the body's moment this shape attaches.
moment | A float number. |
var setMoment | ( | var | moment | ) |
Set this shape's moment.
It will change the body's moment this shape attaches.
moment | A float number. |
local setMoment | ( | local | moment | ) |
Set this shape's moment.
It will change the body's moment this shape attaches.
moment | A float number. |
|
inline |
Set this shape's tag.
tag | An integer number that identifies a shape object. |
|
inline |
Set this shape's tag.
tag | An integer number that identifies a shape object. |
|
inline |
Set this shape's tag.
tag | An integer number that identifies a shape object. |
|
inline |
Get this shape's tag.
|
inline |
Get this shape's tag.
|
inline |
Get this shape's tag.
|
inline |
Get the mass of this shape.
|
inline |
Get the mass of this shape.
|
inline |
Get the mass of this shape.
void setMass | ( | float | mass | ) |
Set this shape's mass.
It will change the body's mass this shape attaches.
mass | A float number. |
var setMass | ( | var | mass | ) |
Set this shape's mass.
It will change the body's mass this shape attaches.
mass | A float number. |
local setMass | ( | local | mass | ) |
Set this shape's mass.
It will change the body's mass this shape attaches.
mass | A float number. |
|
inline |
Get this shape's density.
|
inline |
Get this shape's density.
|
inline |
Get this shape's density.
void setDensity | ( | float | density | ) |
Set this shape's density.
It will change the body's mass this shape attaches.
density | A float number. |
var setDensity | ( | var | density | ) |
Set this shape's density.
It will change the body's mass this shape attaches.
density | A float number. |
local setDensity | ( | local | density | ) |
Set this shape's density.
It will change the body's mass this shape attaches.
density | A float number. |
|
inline |
Get this shape's restitution.
|
inline |
Get this shape's restitution.
|
inline |
Get this shape's restitution.
void setRestitution | ( | float | restitution | ) |
Set this shape's restitution.
It will change the shape's elasticity.
restitution | A float number. |
var setRestitution | ( | var | restitution | ) |
Set this shape's restitution.
It will change the shape's elasticity.
restitution | A float number. |
local setRestitution | ( | local | restitution | ) |
Set this shape's restitution.
It will change the shape's elasticity.
restitution | A float number. |
|
inline |
Get this shape's friction.
|
inline |
Get this shape's friction.
|
inline |
Get this shape's friction.
void setFriction | ( | float | friction | ) |
Set this shape's friction.
It will change the shape's friction.
friction | A float number. |
var setFriction | ( | var | friction | ) |
Set this shape's friction.
It will change the shape's friction.
friction | A float number. |
local setFriction | ( | local | friction | ) |
Set this shape's friction.
It will change the shape's friction.
friction | A float number. |
|
inline |
Get this shape's PhysicsMaterial object.
|
inline |
Get this shape's PhysicsMaterial object.
|
inline |
Get this shape's PhysicsMaterial object.
void setMaterial | ( | const PhysicsMaterial & | material | ) |
Set this shape's material.
It will change the shape's mass, elasticity and friction.
material | A PhysicsMaterial object. |
var setMaterial | ( | var | material | ) |
Set this shape's material.
It will change the shape's mass, elasticity and friction.
material | A PhysicsMaterial object. |
local setMaterial | ( | local | material | ) |
Set this shape's material.
It will change the shape's mass, elasticity and friction.
material | A PhysicsMaterial object. |
|
inlinevirtual |
Calculate the default moment value.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapePolygon, and PhysicsShapeCircle.
|
inlinevirtual |
Calculate the default moment value.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapePolygon, and PhysicsShapeCircle.
|
inlinevirtual |
Calculate the default moment value.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapePolygon, and PhysicsShapeCircle.
|
inlinevirtual |
Get this shape's position offset.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapeEdgeBox, PhysicsShapeBox, and PhysicsShapeCircle.
|
inlinevirtual |
Get this shape's position offset.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapeEdgeBox, PhysicsShapeBox, and PhysicsShapeCircle.
|
inlinevirtual |
Get this shape's position offset.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapeEdgeBox, PhysicsShapeBox, and PhysicsShapeCircle.
|
inlinevirtual |
Get this shape's center position.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapeEdgeChain, PhysicsShapeEdgePolygon, PhysicsShapeEdgeSegment, and PhysicsShapePolygon.
|
inlinevirtual |
Get this shape's center position.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapeEdgeChain, PhysicsShapeEdgePolygon, PhysicsShapeEdgeSegment, and PhysicsShapePolygon.
|
inlinevirtual |
Get this shape's center position.
This function should be overridden in inherit classes.
Reimplemented in PhysicsShapeEdgeChain, PhysicsShapeEdgePolygon, PhysicsShapeEdgeSegment, and PhysicsShapePolygon.
bool containsPoint | ( | const Vec2 & | point | ) | const |
var containsPoint | ( | var | point | ) |
local containsPoint | ( | local | point | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inline |
Set 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.
bitmask | An integer number, the default value is 0xFFFFFFFF (all bits set). |
|
inline |
Set 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.
bitmask | An integer number, the default value is 0xFFFFFFFF (all bits set). |
|
inline |
Set 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.
bitmask | An integer number, the default value is 0xFFFFFFFF (all bits set). |
|
inline |
Get a mask that defines which categories this physics body belongs to.
|
inline |
Get a mask that defines which categories this physics body belongs to.
|
inline |
Get a mask that defines which categories this physics body belongs to.
|
inline |
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.
bitmask | An integer number, the default value is 0x00000000 (all bits cleared). |
|
inline |
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.
bitmask | An integer number, the default value is 0x00000000 (all bits cleared). |
|
inline |
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.
bitmask | An integer number, the default value is 0x00000000 (all bits cleared). |
|
inline |
Get a mask that defines which categories of bodies cause intersection notifications with this physics body.
|
inline |
Get a mask that defines which categories of bodies cause intersection notifications with this physics body.
|
inline |
Get a mask that defines which categories of bodies cause intersection notifications with this physics body.
|
inline |
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.
bitmask | An integer number, the default value is 0xFFFFFFFF (all bits set). |
|
inline |
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.
bitmask | An integer number, the default value is 0xFFFFFFFF (all bits set). |
|
inline |
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.
bitmask | An integer number, the default value is 0xFFFFFFFF (all bits set). |
|
inline |
Get a mask that defines which categories of physics bodies can collide with this physics body.
|
inline |
Get a mask that defines which categories of physics bodies can collide with this physics body.
|
inline |
Get a mask that defines which categories of physics bodies can collide with this physics body.
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).
group | An integer number, 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).
group | An integer number, 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).
group | An integer number, it have high priority than bit masks. |
|
inline |
Get the group of body.
|
inline |
Get the group of body.
|
inline |
Get the group of body.