Static methods
staticapplyAngularImpulse(body:B2Body, impulse:Float):Void
- Apply an angular impulse.
Parameters:
body | body |
|---|---|
impulse | the angular impulse in units of |
staticapplyForce(body:B2Body, force:Vector3, point:Vector3):Void
- Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.
Parameters:
body | body |
|---|---|
force | the world force vector, usually in Newtons (N). |
point | the world position of the point of application. |
staticapplyForceToCenter(body:B2Body, force:Vector3):Void
- Apply a force to the center of mass. This wakes up the body.
Parameters:
body | body |
|---|---|
force | the world force vector, usually in Newtons (N). |
staticapplyLinearImpulse(body:B2Body, impulse:Vector3, point:Vector3):Void
- Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
Parameters:
body | body |
|---|---|
impulse | the world impulse vector, usually in N-seconds or kg-m/s. |
point | the world position of the point of application. |
staticapplyTorque(body:B2Body, torque:Float):Void
- Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
Parameters:
body | body |
|---|---|
torque | about the z-axis (out of the screen), usually in N-m. |
staticgetAngularDamping(body:B2Body):Float
- Get the angular damping of the body.
Parameters:
body | body |
|---|
Returns:
the angular damping of the body.
staticgetAngularVelocity(body:B2Body):Float
- Get the angular velocity.
Parameters:
body | body |
|---|
Returns:
the angular velocity in radians/second.
staticgetGravityScale(body:B2Body):Float
- Get the gravity scale of the body.
Parameters:
body | body |
|---|
Returns:
the gravity scale of the body.
staticgetInertia(body:B2Body):Float
- Get the rotational inertia of the body about the local origin.
Parameters:
body | body |
|---|
Returns:
the rotational inertia, usually in kg-m^2.
staticgetLinearDamping(body:B2Body):Float
- Get the linear damping of the body.
Parameters:
body | body |
|---|
Returns:
the linear damping of the body.
staticgetLinearVelocity(body:B2Body):Vector3
- Get the linear velocity of the center of mass.
Parameters:
body | body |
|---|
Returns:
the linear velocity of the center of mass.
staticgetLocalCenter(body:B2Body):Vector3
- Get the local position of the center of mass.
Parameters:
body | body |
|---|
Returns:
the local position of the center of mass.
staticgetLocalPoint(body:B2Body, world_point:Vector3):Vector3
- Gets a local point relative to the body's origin given a world point.
Parameters:
body | body |
|---|---|
world_point | a point in world coordinates. |
Returns:
the corresponding local point relative to the body's origin.
staticgetLocalVector(body:B2Body, world_vector:Vector3):Vector3
- Gets a local vector given a world vector.
Parameters:
body | body |
|---|---|
world_vector | a vector in world coordinates. |
Returns:
the corresponding local vector.
staticgetMass(body:B2Body):Float
- Get the total mass of the body.
Parameters:
body | body |
|---|
Returns:
the mass, usually in kilograms (kg).
staticgetPosition(body:B2Body):Vector3
- Get the world body origin position.
Parameters:
body | body |
|---|
Returns:
the world position of the body's origin.
staticgetRotation(body:B2Body):Float
- Get the body rotation.
Parameters:
body | body |
|---|
Returns:
the current world rotation angle in radians.
staticgetType(body:B2Body):B2BodyType
- Get the body type. A dynamic body is fully simulated. Static bodies do not move. Kinematic bodies are not subject to forces but can move with a linear velocity.
Parameters:
body | body |
|---|
Returns:
the body type: Static, Kinematic, or Dynamic
staticgetWorld(body:B2Body):B2World
- Gets the Box2D world to which this body belongs.
Parameters:
body | body |
|---|
Returns:
the world this body belongs to
staticgetWorldCenter(body:B2Body):Vector3
- Get the world position of the center of mass.
Parameters:
body | body |
|---|
Returns:
the world position of the center of mass.
staticgetWorldPoint(body:B2Body, local_point:Vector3):Vector3
- Get the world coordinates of a point given the local coordinates.
Parameters:
body | body |
|---|---|
local_point | a point on the body measured relative the body's origin. |
Returns:
the same point expressed in world coordinates.
staticgetWorldVector(body:B2Body, local_vector:Vector3):Vector3
- Get the world coordinates of a vector given the local coordinates.
Parameters:
body | body |
|---|---|
local_vector | a vector fixed in the body. |
Returns:
the same vector expressed in world coordinates.
staticsetAngularDamping(body:B2Body, damping:Float):Void
- Set the angular damping of the body.
Parameters:
body | body |
|---|---|
damping | the new angular damping. |
staticsetAngularVelocity(body:B2Body, velocity:Float):Void
- Set the angular velocity.
Parameters:
body | body |
|---|---|
velocity | the new angular velocity in radians/second. |
staticsetAwake(body:B2Body, awake:Bool):Void
- Set the sleep state of the body. A sleeping body has very low CPU cost.
Parameters:
body | body |
|---|---|
awake | set to true to wake the body, false to put it to sleep. |
staticsetBullet(body:B2Body, bullet:Bool):Void
- Set the bullet state of the body. Bullet bodies are subject to continuous collision detection with dynamic bodies.
Parameters:
body | body |
|---|---|
bullet | set to true to enable continuous collision detection with dynamic bodies. |
staticsetFixedRotation(body:B2Body, fixed_rotation:Bool):Void
- Set the fixed rotation state of the body. Fixed rotation bodies do not rotate.
Parameters:
body | body |
|---|---|
fixed_rotation | set to true to prevent body from rotating. |
staticsetGravityScale(body:B2Body, scale:Float):Void
- Set the gravity scale of the body.
Parameters:
body | body |
|---|---|
scale | the new gravity scale. |
staticsetLinearDamping(body:B2Body, damping:Float):Void
- Set the linear damping of the body.
Parameters:
body | body |
|---|---|
damping | the new linear damping. |
staticsetLinearVelocity(body:B2Body, velocity:Vector3):Void
- Set the linear velocity of the center of mass.
Parameters:
body | body |
|---|---|
velocity | the new linear velocity of the center of mass. |
staticsetPosition(body:B2Body, position:Vector3):Void
- Set the position of the body's origin.
Parameters:
body | body |
|---|---|
position | the world position of the body's origin. |
staticsetRotation(body:B2Body, angle:Float):Void
- Set the body rotation.
Parameters:
body | body |
|---|---|
angle | the new rotation angle in radians. |
staticsetTransform(body:B2Body, position:Vector3, angle:Float):Void
- Set the position and angle of the body.
Parameters:
body | body |
|---|---|
position | the world position of the body's origin. |
angle | the world rotation angle in radians. |
staticsetType(body:B2Body, type:B2BodyType):Void
- Set the body type. A dynamic body is fully simulated. Static bodies do not move. Kinematic bodies are not subject to forces but can move with a linear velocity.
Parameters:
body | body |
|---|---|
type | the body type: Static, Kinematic, or Dynamic |