Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
b2BodyDef Struct Reference

`#include <b2Body.h>`

## Public Member Functions
| b2BodyDef ()
| This constructor sets the body definition default values. More...

## Public Attributes
b2BodyType | type
b2Vec2 | position
float32 | angle
| The world angle of the body in radians. More...
b2Vec2 | linearVelocity
| The linear velocity of the body's origin in world co-ordinates. More...
float32 | angularVelocity
| The angular velocity of the body. More...
float32 | linearDamping
float32 | angularDamping
bool | allowSleep
bool | awake
| Is this body initially awake or sleeping? More...
bool | fixedRotation
| Should this body be prevented from rotating? Useful for characters. More...
bool | bullet
bool | active
| Does this body start out active? More...
void * | userData
| Use this to store application specific body data. More...
float32 | gravityScale
| Scale the gravity applied to this body. More...

## Detailed Description

A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction.

## Constructor & Destructor Documentation

b2BodyDef | ( |  | ) |
| inline

This constructor sets the body definition default values.

## Member Data Documentation

bool active

Does this body start out active?

bool allowSleep

Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.

float32 angle

The world angle of the body in radians.

float32 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.

float32 angularVelocity

The angular velocity of the body.

bool awake

Is this body initially awake or sleeping?

bool bullet

Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.

Warning
  You should use this flag sparingly since it increases processing time.

bool fixedRotation

Should this body be prevented from rotating? Useful for characters.

float32 gravityScale

Scale the gravity applied to this body.

float32 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.

b2Vec2 linearVelocity

The linear velocity of the body's origin in world co-ordinates.

b2Vec2 position

The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.

b2BodyType type

The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.

void* userData

Use this to store application specific body data.

The documentation for this struct was generated from the following file:

- Box2D/Dynamics/b2Body.h