blaze.dynamics.Body



class Body ;
A rigid body

bXForm xf ;
The body's origin transform

bVec2 linearVelocity ;
The body's linear velocity

float angularVelocity ;
the body's angular velocity

bVec2 force ;
The force exerted on this body

float torque ;
The torque exerted on this body

bool isStatic ;
Is this body static (immovable)?

Body prev ;
Next body in the world linked body list

Body next ;
Previous body in the world linked body list

float linearDamping ;
Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large. An example of the use of this is drag from friction with the air.

float angularDamping ;
Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.

Object userData ;
A reference to whatever data you want attached to the body. This may be redundant because of the userData member of blaze.collision.shapes.shape.Shape

Shape createShape (ShapeDef def);
Creates a shape and attach it to this body.

Params:
shapeDef the shape definition.

Warning:
This function is locked during callbacks.

void destroyShape (Shape s);
Destroy a shape. This removes the shape from the broad-phase and therefore destroys any contacts associated with this shape. All shapes attached to a body are implicitly destroyed when the body is destroyed.

Params:
shape the shape to be removed.

Warning:
This function is locked during callbacks.

void setMass (MassData massData);
Set the mass properties. Note that this changes the center of mass position. If you are not sure how to compute mass properties, use SetMassFromShapes. The inertia tensor is assumed to be relative to the center of mass.

Params:
MassData massData the mass properties.

void setMassFromShapes ();
Compute the mass properties from the attached shapes. You typically call this after adding all the shapes. If you add or remove shapes later, you may want to call this again. Note that this changes the center of mass position.

bool xForm (bVec2 position, float angle);
Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies.

Params:
bVec2 position the new world position of the body's origin (not necessarily the center of mass).
float angle the new world rotation angle of the body in radians.

Returns:
false if the movement put a shape outside the world. In this case the body is automatically frozen.

BUGS:
See Shape.synchronize

bVec2 position ();
Returns:
the world position of the body's origin.

float angle ();
Returns:
the current world rotation angle in radians.

void angle (float a);
Set the body's angle

Params:
float a the new angle (in radians)

bVec2 worldCenter ();
Returns:
the world position of the center of mass.

bVec2 localCenter ();
Returns:
the local position of the center of mass.

void applyForce (bVec2 force, bVec2 point);
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.

Params:
bVec2 force the world force vector, usually in Newtons (N).
bVec2 point the world position of the point of application.

void applyBuoyancyForce (FluidParticle particle);
Applies a bouyancy force caused by fluid particles. This wakes up the body.

Params:
FluidParticle particle the fluid particle that will apply the force

void applyTorque (float torque);
Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.

Params:
float torque torque about the z-axis (out of the screen), usually measured in Newton-meters

void applyImpulse (bVec2 impulse, bVec2 point);
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.

Params:
bVec2 impulse the world impulse vector, usually in Newton-seconds or kg-m/s.
bVec2 point the world position of the point of application.

float mass ();
Returns:
the total mass of the body, usually in kilograms.

float invMass ();
Returns:
1 divided by the total mass of the body. Units are 1/kg

float inertia ();
Get the central rotational inertia of the body.

Returns:
the rotational inertia , usually in kg-m^2.

float invI ();
Returns:
the inverse rotational inertia of the body.

bVec2 worldPoint (bVec2 localPoint);
Get the world coordinates of a point given the local coordinates.

Params:
bVec2 localPoint a point on the body measured relative the the body's origin.

Returns:
the same point expressed in world coordinates.

bVec2 worldVector (bVec2 localVector);
Get the world coordinates of a vector given the local coordinates.

Params:
bVec2 localVector a vector fixed in the body.

Params:

bVec2 localPoint (bVec2 worldPoint);
Gets a local point relative to the body's origin given a world point.

Params:
bVec2 worldPoint a point in world coordinates.

Returns:
the corresponding local point relative to the body's origin.

bVec2 localVector (bVec2 worldVector);
Gets a local vector given a world vector.

Params:

Returns:
the corresponding local vector.

bVec2 linearVelocityFromWorldPoint (bVec2 worldPoint);
Get the world linear velocity of a world point attached to this body.

Params:
bVec2 worldPoint a point in world coordinates.

Returns:
the world velocity of a point.

bVec2 linearVelocityFromLocalPoint (bVec2 localPoint);
Get the world velocity of a local point.

Params:
bVec2 localPoint a point in local coordinates.

Returns:
the world velocity of a point.

int bullet ();
Returns:
true if this body treated like a bullet for continuous collision detection, false otherwise.

void bullet (bool flag);
Sets whether or not this body be treated like a bullet for continuous collision detection. This will cause the collision detection to be more accurate, but less efficient. Use this only on bodies that will have high speeds.

Params:
bool flag true if the body should be treated as a bullet , false otherwise.

int isFrozen ();
Returns:
true if the body is frozen, false otherwise.

int isSleeping ();
Returns:
true if the body is sleeping, false otherwise.

void allowSleeping (bool flag);
Sets wheter or not sleeping is allowed for this body.

Params:
bool flag true if the body can go to sleep when it stops moving, false if it cannot.

void wakeup ();
Wake up this body so it will begin simulating.

void putToSleep ();
Put this body to sleep so it will stop simulating.

Note:
This also sets the velocity to zero.

Shape shapeList ();
Get the firsh shape attached to this body. Access to the other shapes is accomplished through Shape.next

Returns:
the first shape attached to this body.

int shapeCount ();
Returns:
the number of shapes attached to this body

World world ();
Returns:
the parent world of this body.

bSweep sweep ;
The swept motion for CCD

static const int FROZEN ;
flags

ushort flags ;
The body's status flags

this(BodyDef bd, World world);
Constructor

Params:
BodyDef bd the body definition to base this body off of
World world the world that this body will be a part of

Warning:
This function assert()'s that the world is not locked

bool synchronizeShapes ();
Synchronizes all the shapes in the body.

BUGS:
Always returns true

void synchronizeTransform ();
Update rotation and position of the body

bool isConnected (Body other);
This is used to prevent connected bodies from colliding. It may lie, depending on the collideConnected flag.

void advance (float t);
Advance to the new safe time.

int islandIndex ();
Returns:
the island index of the body

void islandIndex (int i);
Sets the body's island index

Params:
int i the new island index

float sleepTime ();
Returns:
the body's sleep time

void sleepTime (float time);
Sets the body's sleep time

Params:
float time the sleep time

JointEdge jointList ;
The list of joints connected to the body

ContactEdge contactList ;
The list of contacts associated with the body

Page was generated with on Tue Feb 10 19:13:10 2009