ackb2d 0.9
3D Gamestudio Box 2d Wraper

b2Body.h File Reference

Go to the source code of this file.

Functions

b2Fixtureb2Body_CreateFixture (b2Body *body, const b2FixtureDef *def)
b2Fixtureb2Body_CreateFixture2 (b2Body *body, const b2Shape *shape, var density)
void b2Body_DestroyFixture (b2Body *body, b2Fixture *fixture)
void b2Body_SetTransform (b2Body *body, const VECTOR *position, var angle)
void b2Body_GetTransform (b2Body *body, b2Transform *outTransform)
void b2Body_GetPosition (b2Body *body, VECTOR *outPosition)
var b2Body_GetAngle (b2Body *body)
void b2Body_GetWorldCenter (b2Body *body, VECTOR *outCenter)
 Get the world position of the center of mass.
void b2Body_GetLocalCenter (b2Body *body, VECTOR *outCenter)
 Get the local position of the center of mass.
void b2Body_SetLinearVelocity (b2Body *body, const VECTOR *v)
void b2Body_GetLinearVelocity (b2Body *body, VECTOR *velocity)
void b2Body_SetAngularVelocity (b2Body *body, var omega)
var b2Body_GetAngularVelocity (b2Body *body)
void b2Body_ApplyForce (b2Body *body, const VECTOR *force, const VECTOR *point)
void b2Body_ApplyTorque (b2Body *body, var torque)
void b2Body_ApplyLinearImpulse (b2Body *body, const VECTOR *impulse, const VECTOR *point)
void b2Body_ApplyAngularImpulse (b2Body *body, var impulse)
var b2Body_GetMass (b2Body *body)
var b2Body_GetInertia (b2Body *body)
void b2Body_GetMassData (b2Body *body, b2MassData *data)
void b2Body_SetMassData (b2Body *body, const b2MassData *data)
void b2Body_ResetMassData (b2Body *body)
void b2Body_GetWorldPoint (b2Body *body, const VECTOR *localPoint, VECTOR *outWorldPoint)
void b2Body_GetWorldVector (b2Body *body, const VECTOR *localVector, VECTOR *outWorldVector)
void b2Body_GetLocalPoint (b2Body *body, const VECTOR *worldPoint, VECTOR *outLocalPoint)
void b2Body_GetLocalVector (b2Body *body, const VECTOR *worldVector, VECTOR *outLocalVector)
void b2Body_GetLinearVelocityFromWorldPoint (b2Body *body, const VECTOR *worldPoint, VECTOR *outLinearVelocity)
void b2Body_GetLinearVelocityFromLocalPoint (b2Body *body, const VECTOR *localPoint, VECTOR *outLinearVelocity)
var b2Body_GetLinearDamping (b2Body *body)
 Get the linear damping of the body.
void b2Body_SetLinearDamping (b2Body *body, var linearDamping)
 Set the linear damping of the body.
var b2Body_GetAngularDamping (b2Body *body)
 Get the angular damping of the body.
void b2Body_SetAngularDamping (b2Body *body, var angularDamping)
 Set the angular damping of the body.
void b2Body_SetType (b2Body *body, var type)
 Set the type of this body. This may alter the mass and velocity.
var b2Body_GetType (b2Body *body)
 Get the type of this body.
void b2Body_SetBullet (b2Body *body, var flag)
 Should this body be treated like a bullet for continuous collision detection?
var b2Body_IsBullet (b2Body *body)
 Is this body treated like a bullet for continuous collision detection?
void b2Body_SetSleepingAllowed (b2Body *body, var flag)
var b2Body_IsSleepingAllowed (b2Body *body)
 Is this body allowed to sleep.
void b2Body_SetAwake (b2Body *body, var flag)
var b2Body_IsAwake (b2Body *body)
void b2Body_SetActive (b2Body *body, var flag)
var b2Body_IsActive (b2Body *body)
 Get the active state of the body.
void b2Body_SetFixedRotation (b2Body *body, var flag)
var b2Body_IsFixedRotation (b2Body *body)
 Does this body have fixed rotation?
b2Fixtureb2Body_GetFixtureList (b2Body *body)
 Get the list of all fixtures attached to this body.
b2JointEdgeb2Body_GetJointList (b2Body *body)
 Get the list of all joints attached to this body.
b2ContactEdgeb2Body_GetContactList (b2Body *body)
b2Bodyb2Body_GetNext (b2Body *body)
 Get the next body in the world's body list.
void * b2Body_GetUserData (b2Body *body)
 Get the user data pointer that was provided in the body definition.
void b2Body_SetUserData (b2Body *body, void *data)
 Set the user data. Use this to store your application specific data.
b2Worldb2Body_GetWorld (b2Body *body)
 Get the parent world of this body.

Function Documentation

void b2Body_ApplyAngularImpulse ( b2Body body,
var  impulse 
)

Apply an angular impulse.

Parameters:
impulsethe angular impulse in units of kg*m*m/s
void b2Body_ApplyForce ( b2Body body,
const VECTOR *  force,
const VECTOR *  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.

Parameters:
forcethe world force vector, usually in Newtons (N).
pointthe world position of the point of application.
void b2Body_ApplyLinearImpulse ( b2Body body,
const VECTOR *  impulse,
const VECTOR *  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.

Parameters:
impulsethe world impulse vector, usually in N-seconds or kg-m/s.
pointthe world position of the point of application.
void b2Body_ApplyTorque ( b2Body body,
var  torque 
)

Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.

Parameters:
torqueabout the z-axis (out of the screen), usually in N-m.
b2Fixture* b2Body_CreateFixture ( b2Body body,
const b2FixtureDef def 
)

Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.

Parameters:
defthe fixture definition.
Warning:
This function is locked during callbacks.
b2Fixture* b2Body_CreateFixture2 ( b2Body body,
const b2Shape shape,
var  density 
)

Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically updates the mass of the body.

Parameters:
shapethe shape to be cloned.
densitythe shape density (set to zero for static bodies).
Warning:
This function is locked during callbacks.
void b2Body_DestroyFixture ( b2Body body,
b2Fixture fixture 
)

Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.

Parameters:
fixturethe fixture to be removed.
Warning:
This function is locked during callbacks.
var b2Body_GetAngle ( b2Body body)

Get the angle in radians.

Returns:
the current world rotation angle in radians.
var b2Body_GetAngularDamping ( b2Body body)

Get the angular damping of the body.

var b2Body_GetAngularVelocity ( b2Body body)

Get the angular velocity.

Returns:
the angular velocity in radians/second.
b2ContactEdge* b2Body_GetContactList ( b2Body body)

Get the list of all contacts attached to this body.

Warning:
this list changes during the time step and you may miss some collisions if you don't use b2ContactListener.
b2Fixture* b2Body_GetFixtureList ( b2Body body)

Get the list of all fixtures attached to this body.

var b2Body_GetInertia ( b2Body body)

Get the rotational inertia of the body about the local origin.

Returns:
the rotational inertia, usually in kg-m^2.
b2JointEdge* b2Body_GetJointList ( b2Body body)

Get the list of all joints attached to this body.

var b2Body_GetLinearDamping ( b2Body body)

Get the linear damping of the body.

void b2Body_GetLinearVelocity ( b2Body body,
VECTOR *  velocity 
)

Get the linear velocity of the center of mass.

Returns:
the linear velocity of the center of mass.
void b2Body_GetLinearVelocityFromLocalPoint ( b2Body body,
const VECTOR *  localPoint,
VECTOR *  outLinearVelocity 
)

Get the world velocity of a local point.

Parameters:
apoint in local coordinates.
Returns:
the world velocity of a point.
void b2Body_GetLinearVelocityFromWorldPoint ( b2Body body,
const VECTOR *  worldPoint,
VECTOR *  outLinearVelocity 
)

Get the world linear velocity of a world point attached to this body.

Parameters:
apoint in world coordinates.
Returns:
the world velocity of a point.
void b2Body_GetLocalCenter ( b2Body body,
VECTOR *  outCenter 
)

Get the local position of the center of mass.

void b2Body_GetLocalPoint ( b2Body body,
const VECTOR *  worldPoint,
VECTOR *  outLocalPoint 
)

Gets a local point relative to the body's origin given a world point.

Parameters:
apoint in world coordinates.
Returns:
the corresponding local point relative to the body's origin.
void b2Body_GetLocalVector ( b2Body body,
const VECTOR *  worldVector,
VECTOR *  outLocalVector 
)

Gets a local vector given a world vector.

Parameters:
avector in world coordinates.
Returns:
the corresponding local vector.
var b2Body_GetMass ( b2Body body)

Get the total mass of the body.

Returns:
the mass, usually in kilograms (kg).
void b2Body_GetMassData ( b2Body body,
b2MassData data 
)

Get the mass data of the body.

Returns:
a struct containing the mass, inertia and center of the body.
b2Body* b2Body_GetNext ( b2Body body)

Get the next body in the world's body list.

void b2Body_GetPosition ( b2Body body,
VECTOR *  outPosition 
)

Get the world body origin position.

Returns:
the world position of the body's origin.
void b2Body_GetTransform ( b2Body body,
b2Transform outTransform 
)

Get the body transform for the body's origin.

Returns:
the world transform of the body's origin.
var b2Body_GetType ( b2Body body)

Get the type of this body.

void* b2Body_GetUserData ( b2Body body)

Get the user data pointer that was provided in the body definition.

b2World* b2Body_GetWorld ( b2Body body)

Get the parent world of this body.

void b2Body_GetWorldCenter ( b2Body body,
VECTOR *  outCenter 
)

Get the world position of the center of mass.

void b2Body_GetWorldPoint ( b2Body body,
const VECTOR *  localPoint,
VECTOR *  outWorldPoint 
)

Get the world coordinates of a point given the local coordinates.

Parameters:
localPointa point on the body measured relative the the body's origin.
Returns:
the same point expressed in world coordinates.
void b2Body_GetWorldVector ( b2Body body,
const VECTOR *  localVector,
VECTOR *  outWorldVector 
)

Get the world coordinates of a vector given the local coordinates.

Parameters:
localVectora vector fixed in the body.
Returns:
the same vector expressed in world coordinates.
var b2Body_IsActive ( b2Body body)

Get the active state of the body.

var b2Body_IsAwake ( b2Body body)

Get the sleeping state of this body.

Returns:
true if the body is sleeping.
var b2Body_IsBullet ( b2Body body)

Is this body treated like a bullet for continuous collision detection?

var b2Body_IsFixedRotation ( b2Body body)

Does this body have fixed rotation?

var b2Body_IsSleepingAllowed ( b2Body body)

Is this body allowed to sleep.

void b2Body_ResetMassData ( b2Body body)

This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass.

void b2Body_SetActive ( b2Body body,
var  flag 
)

Set the active state of the body. An inactive body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected. You may continue to create/destroy fixtures and joints on inactive bodies. Fixtures on an inactive body are implicitly inactive and will not participate in collisions, ray-casts, or queries. Joints connected to an inactive body are implicitly inactive. An inactive body is still owned by a b2World object and remains in the body list.

void b2Body_SetAngularDamping ( b2Body body,
var  angularDamping 
)

Set the angular damping of the body.

void b2Body_SetAngularVelocity ( b2Body body,
var  omega 
)

Set the angular velocity.

Parameters:
omegathe new angular velocity in radians/second.
void b2Body_SetAwake ( b2Body body,
var  flag 
)

Set the sleep state of the body. A sleeping body has very low CPU cost.

Parameters:
flagset to true to put body to sleep, false to wake it.
void b2Body_SetBullet ( b2Body body,
var  flag 
)

Should this body be treated like a bullet for continuous collision detection?

void b2Body_SetFixedRotation ( b2Body body,
var  flag 
)

Set this body to have fixed rotation. This causes the mass to be reset.

void b2Body_SetLinearDamping ( b2Body body,
var  linearDamping 
)

Set the linear damping of the body.

void b2Body_SetLinearVelocity ( b2Body body,
const VECTOR *  v 
)

Set the linear velocity of the center of mass.

Parameters:
vthe new linear velocity of the center of mass.
void b2Body_SetMassData ( b2Body body,
const b2MassData data 
)

Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.

Parameters:
massDatathe mass properties.
void b2Body_SetSleepingAllowed ( b2Body body,
var  flag 
)

You can disable sleeping on this body. If you disable sleeping, the body will be woken.

void b2Body_SetTransform ( b2Body body,
const VECTOR *  position,
var  angle 
)

Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.

Parameters:
positionthe world position of the body's local origin.
anglethe world rotation in radians.
void b2Body_SetType ( b2Body body,
var  type 
)

Set the type of this body. This may alter the mass and velocity.

void b2Body_SetUserData ( b2Body body,
void *  data 
)

Set the user data. Use this to store your application specific data.

 All Data Structures Files Functions Variables Typedefs Defines