Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Member Functions | Public Attributes | List of all members
box2d::BodyDef Struct Reference

Body Definition. More...

#include <Body.hpp>

Public Member Functions

constexpr BodyDef ()=default
 This constructor sets the body definition default values. More...
 
constexpr BodyDefUseType (BodyType t) noexcept
 
constexpr BodyDefUseLocation (Length2D l) noexcept
 
constexpr BodyDefUseAngle (Angle a) noexcept
 
constexpr BodyDefUseLinearVelocity (LinearVelocity2D v) noexcept
 
constexpr BodyDefUseAngularVelocity (AngularVelocity v) noexcept
 
constexpr BodyDefUseLinearAcceleration (LinearAcceleration2D v) noexcept
 
constexpr BodyDefUseAngularAcceleration (AngularAcceleration v) noexcept
 
constexpr BodyDefUseLinearDamping (RealNum v) noexcept
 
constexpr BodyDefUseAngularDamping (RealNum v) noexcept
 
constexpr BodyDefUseUnderActiveTime (Time v) noexcept
 
constexpr BodyDefUseAllowSleep (bool value) noexcept
 
constexpr BodyDefUseAwake (bool value) noexcept
 
constexpr BodyDefUseFixedRotation (bool value) noexcept
 
constexpr BodyDefUseBullet (bool value) noexcept
 
constexpr BodyDefUseEnabled (bool value) noexcept
 
constexpr BodyDefUseUserData (void *value) noexcept
 

Public Attributes

BodyType type = BodyType::Static
 The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one. More...
 
Length2D position = Vec2_zero * Meter
 The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes. More...
 
Angle angle = Angle{0}
 The world angle of the body in radians. More...
 
LinearVelocity2D linearVelocity = Vec2_zero * MeterPerSecond
 The linear velocity of the body's origin in world co-ordinates (in m/s). More...
 
AngularVelocity angularVelocity = AngularVelocity{0}
 The angular velocity of the body. More...
 
LinearAcceleration2D linearAcceleration = Vec2_zero * MeterPerSquareSecond
 
AngularAcceleration angularAcceleration = AngularAcceleration{0}
 
RealNum linearDamping = 0
 Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1 but the damping effect becomes sensitive to the time step when the damping parameter is large. More...
 
RealNum angularDamping = 0
 Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1 but the damping effect becomes sensitive to the time step when the damping parameter is large. More...
 
Time underActiveTime = Second * RealNum{0}
 Under-active time. More...
 
bool allowSleep = true
 Set this flag to false if this body should never fall asleep. Note that this increases CPU usage. More...
 
bool awake = true
 Is this body initially awake or sleeping? More...
 
bool fixedRotation = false
 Should this body be prevented from rotating? Useful for characters. More...
 
bool bullet = false
 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. More...
 
bool enabled = true
 Does this body start out enabled? More...
 
void * userData = nullptr
 Use this to store application specific body data. More...
 

Detailed Description

Body Definition.

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

Constructor & Destructor Documentation

◆ BodyDef()

constexpr box2d::BodyDef::BodyDef ( )
default

This constructor sets the body definition default values.

Member Function Documentation

◆ UseAllowSleep()

constexpr BodyDef & box2d::BodyDef::UseAllowSleep ( bool  value)
inlinenoexcept

◆ UseAngle()

constexpr BodyDef & box2d::BodyDef::UseAngle ( Angle  a)
inlinenoexcept

◆ UseAngularAcceleration()

constexpr BodyDef & box2d::BodyDef::UseAngularAcceleration ( AngularAcceleration  v)
noexcept

◆ UseAngularDamping()

constexpr BodyDef & box2d::BodyDef::UseAngularDamping ( RealNum  v)
inlinenoexcept

◆ UseAngularVelocity()

constexpr BodyDef & box2d::BodyDef::UseAngularVelocity ( AngularVelocity  v)
noexcept

◆ UseAwake()

constexpr BodyDef & box2d::BodyDef::UseAwake ( bool  value)
inlinenoexcept

◆ UseBullet()

constexpr BodyDef & box2d::BodyDef::UseBullet ( bool  value)
inlinenoexcept

◆ UseEnabled()

constexpr BodyDef & box2d::BodyDef::UseEnabled ( bool  value)
inlinenoexcept

◆ UseFixedRotation()

constexpr BodyDef & box2d::BodyDef::UseFixedRotation ( bool  value)
inlinenoexcept

◆ UseLinearAcceleration()

constexpr BodyDef & box2d::BodyDef::UseLinearAcceleration ( LinearAcceleration2D  v)
noexcept

◆ UseLinearDamping()

constexpr BodyDef & box2d::BodyDef::UseLinearDamping ( RealNum  v)
inlinenoexcept

◆ UseLinearVelocity()

constexpr BodyDef & box2d::BodyDef::UseLinearVelocity ( LinearVelocity2D  v)
noexcept

◆ UseLocation()

constexpr BodyDef & box2d::BodyDef::UseLocation ( Length2D  l)
inlinenoexcept

◆ UseType()

constexpr BodyDef & box2d::BodyDef::UseType ( BodyType  t)
inlinenoexcept

◆ UseUnderActiveTime()

constexpr BodyDef & box2d::BodyDef::UseUnderActiveTime ( Time  v)
inlinenoexcept

◆ UseUserData()

constexpr BodyDef & box2d::BodyDef::UseUserData ( void *  value)
inlinenoexcept

Member Data Documentation

◆ allowSleep

bool box2d::BodyDef::allowSleep = true

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

◆ angle

Angle box2d::BodyDef::angle = Angle{0}

The world angle of the body in radians.

◆ angularAcceleration

AngularAcceleration box2d::BodyDef::angularAcceleration = AngularAcceleration{0}

◆ angularDamping

RealNum box2d::BodyDef::angularDamping = 0

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

◆ angularVelocity

AngularVelocity box2d::BodyDef::angularVelocity = AngularVelocity{0}

The angular velocity of the body.

◆ awake

bool box2d::BodyDef::awake = true

Is this body initially awake or sleeping?

◆ bullet

bool box2d::BodyDef::bullet = false

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.

Note
Use this flag sparingly since it increases processing time.

◆ enabled

bool box2d::BodyDef::enabled = true

Does this body start out enabled?

◆ fixedRotation

bool box2d::BodyDef::fixedRotation = false

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

◆ linearAcceleration

LinearAcceleration2D box2d::BodyDef::linearAcceleration = Vec2_zero * MeterPerSquareSecond

◆ linearDamping

RealNum box2d::BodyDef::linearDamping = 0

Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1 but the damping effect becomes sensitive to the time step when the damping parameter is large.

◆ linearVelocity

LinearVelocity2D box2d::BodyDef::linearVelocity = Vec2_zero * MeterPerSecond

The linear velocity of the body's origin in world co-ordinates (in m/s).

◆ position

Length2D box2d::BodyDef::position = Vec2_zero * Meter

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

◆ type

BodyType box2d::BodyDef::type = BodyType::Static

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

◆ underActiveTime

Time box2d::BodyDef::underActiveTime = Second * RealNum{0}

Under-active time.

Set this to the value retrieved from Body::GetUnderActiveTime() or leave it as 0.

◆ userData

void* box2d::BodyDef::userData = nullptr

Use this to store application specific body data.


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