Box2D  2.4.1
A 2D physics engine for games
b2BodyDef Struct Reference

#include <b2_body.h>

Public Member Functions

 b2BodyDef ()
 This constructor sets the body definition default values.
 

Public Attributes

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

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.

Member Data Documentation

◆ allowSleep

bool b2BodyDef::allowSleep

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

◆ angularDamping

float b2BodyDef::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. Units are 1/time

◆ bullet

bool b2BodyDef::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.

◆ linearDamping

float b2BodyDef::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. Units are 1/time

◆ position

b2Vec2 b2BodyDef::position

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

◆ type

b2BodyType b2BodyDef::type

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


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