new Body(m, i)
- Source:
Parameters:
Name |
Type |
Description |
m |
number
|
Mass of the body. |
i |
number
|
Moment of inertia of the body. |
Methods
addShape(shape)
- Source:
Parameters:
applyForce(force, r)
- Source:
Parameters:
applyImpulse(j, r)
- Source:
Parameters:
eachArbiter(func)
- Source:
Parameters:
Name |
Type |
Description |
func |
function
|
|
eachConstraint(func)
- Source:
Parameters:
Name |
Type |
Description |
func |
function
|
|
eachShape(func)
- Source:
Parameters:
Name |
Type |
Description |
func |
function
|
|
getAngVel() → {number}
- Source:
Returns:
-
Type
-
number
- Source:
Returns:
-
Type
-
cp.Vect
- Source:
Returns:
-
Type
-
cp.Vect
getVelAtLocalPoint(point) → {cp.Vect}
- Source:
Get the velocity on a body (in world units) at a point on the body in local coordinates.
Parameters:
Name |
Type |
Description |
point |
cp.Vect
|
|
Returns:
-
Type
-
cp.Vect
getVelAtPoint(r) → {cp.Vect}
- Source:
Parameters:
Returns:
-
Type
-
cp.Vect
getVelAtWorldPoint(point) → {cp.Vect}
- Source:
Get the velocity on a body (in world units) at a point on the body in world coordinates.
Parameters:
Name |
Type |
Description |
point |
cp.Vect
|
|
Returns:
-
Type
-
cp.Vect
isRogue() → {boolean}
- Source:
Returns true if the body has not been added to a space.
Returns:
-
Type
-
boolean
isSleeping() → {boolean}
- Source:
Returns true if the body is sleeping.
Returns:
-
Type
-
boolean
kineticEnergy() → {number}
- Source:
Get the kinetic energy of a body.
Returns:
-
Type
-
number
local2World(v) → {cp.Vect}
- Source:
Convert body relative/local coordinates to absolute/world coordinates.
Parameters:
Returns:
-
Type
-
cp.Vect
position_func(dt)
- Source:
Parameters:
Name |
Type |
Description |
dt |
number
|
|
removeConstraint(constraint)
- Source:
Parameters:
Name |
Type |
Description |
constraint |
cp.Constraint
|
|
removeShape(shape)
- Source:
Parameters:
resetForces()
- Source:
setAngle(angle)
- Source:
Parameters:
Name |
Type |
Description |
angle |
number
|
|
setAngleInternal(angle)
- Source:
Parameters:
Name |
Type |
Description |
angle |
number
|
|
setAngVel(w)
- Source:
Parameters:
Name |
Type |
Description |
w |
number
|
|
setMass(mass)
- Source:
Parameters:
Name |
Type |
Description |
mass |
number
|
|
setMoment(moment)
- Source:
Parameters:
Name |
Type |
Description |
moment |
number
|
|
setPos(pos)
- Source:
Parameters:
setVel(velocity)
- Source:
Parameters:
Name |
Type |
Description |
velocity |
cp.Vect
|
|
velocity_func(gravity, damping, dt)
- Source:
Parameters:
Name |
Type |
Description |
gravity |
cp.Vect
|
|
damping |
number
|
|
dt |
number
|
|
world2Local(v) → {cp.Vect}
- Source:
Convert body absolute/world coordinates to relative/local coordinates.
Parameters:
Returns:
-
Type
-
cp.Vect