Body configuration. More...

#include <BodyConf.hpp>

Public Member Functions

PLAYRHO_CONSTEXPR BodyConfUseType (BodyType t) noexcept
 Use the given type. More...
 
PLAYRHO_CONSTEXPR BodyConfUseLocation (Length2 l) noexcept
 Use the given location. More...
 
PLAYRHO_CONSTEXPR BodyConfUseAngle (Angle a) noexcept
 Use the given angle. More...
 
PLAYRHO_CONSTEXPR BodyConfUseLinearVelocity (LinearVelocity2 v) noexcept
 Use the given linear velocity. More...
 
PLAYRHO_CONSTEXPR BodyConfUseAngularVelocity (AngularVelocity v) noexcept
 Use the given angular velocity. More...
 
PLAYRHO_CONSTEXPR BodyConfUse (Position v) noexcept
 Use the given position for the linear and angular positions. More...
 
PLAYRHO_CONSTEXPR BodyConfUse (Velocity v) noexcept
 Use the given velocity for the linear and angular velocities. More...
 
PLAYRHO_CONSTEXPR BodyConfUseLinearAcceleration (LinearAcceleration2 v) noexcept
 Use the given linear acceleration. More...
 
PLAYRHO_CONSTEXPR BodyConfUseAngularAcceleration (AngularAcceleration v) noexcept
 Use the given angular acceleration. More...
 
PLAYRHO_CONSTEXPR BodyConfUseLinearDamping (NonNegative< Frequency > v) noexcept
 Use the given linear damping. More...
 
PLAYRHO_CONSTEXPR BodyConfUseAngularDamping (NonNegative< Frequency > v) noexcept
 Use the given angular damping. More...
 
PLAYRHO_CONSTEXPR BodyConfUseUnderActiveTime (Time v) noexcept
 Use the given under active time. More...
 
PLAYRHO_CONSTEXPR BodyConfUseAllowSleep (bool value) noexcept
 Use the given allow sleep value. More...
 
PLAYRHO_CONSTEXPR BodyConfUseAwake (bool value) noexcept
 Use the given awake value. More...
 
PLAYRHO_CONSTEXPR BodyConfUseFixedRotation (bool value) noexcept
 Use the given fixed rotation state. More...
 
PLAYRHO_CONSTEXPR BodyConfUseBullet (bool value) noexcept
 Use the given bullet state. More...
 
PLAYRHO_CONSTEXPR BodyConfUseEnabled (bool value) noexcept
 Use the given enabled state. More...
 
PLAYRHO_CONSTEXPR BodyConfUseUserData (void *value) noexcept
 Use the given user data. More...
 

Public Attributes

BodyType type = BodyType::Static
 Type of the body: static, kinematic, or dynamic. More...
 
Length2 location = Length2{}
 
Angle angle = 0_deg
 The world angle of the body. More...
 
LinearVelocity2 linearVelocity = LinearVelocity2{}
 The linear velocity of the body's origin in world co-ordinates (in m/s). More...
 
AngularVelocity angularVelocity = 0_rpm
 The angular velocity of the body. More...
 
LinearAcceleration2 linearAcceleration = LinearAcceleration2{}
 
AngularAcceleration angularAcceleration = AngularAcceleration{0 * RadianPerSquareSecond}
 
NonNegative< FrequencylinearDamping = NonNegative<Frequency>{0_Hz}
 
NonNegative< FrequencyangularDamping = NonNegative<Frequency>{0_Hz}
 
Time underActiveTime = 0_s
 
bool allowSleep = true
 
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
 
bool enabled = true
 Does this body start out enabled? More...
 
void * userData = nullptr
 Use this to store application specific body data. More...
 

Related Functions

(Note that these are not member functions.)

PLAYRHO_CONSTEXPR BodyConf GetDefaultBodyConf () noexcept
 Gets the default body definition. More...
 

Detailed Description

Body configuration.

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

Note
This is a value class meant for passing in to the World::CreateBody method.
See also
World.
Examples
Body.cpp, Contact.cpp, HelloWorld.cpp, and World.cpp.

Definition at line 48 of file BodyConf.hpp.

Member Function Documentation

◆ UseType()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseType ( BodyType  t)
inlinenoexcept

Use the given type.

Examples
Body.cpp, Contact.cpp, and World.cpp.

Definition at line 171 of file BodyConf.hpp.

◆ UseLocation()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseLocation ( Length2  l)
inlinenoexcept

Use the given location.

Examples
HelloWorld.cpp, and World.cpp.

Definition at line 177 of file BodyConf.hpp.

◆ UseAngle()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseAngle ( Angle  a)
inlinenoexcept

Use the given angle.

Definition at line 183 of file BodyConf.hpp.

◆ UseLinearVelocity()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseLinearVelocity ( LinearVelocity2  v)
inlinenoexcept

Use the given linear velocity.

Definition at line 203 of file BodyConf.hpp.

◆ UseAngularVelocity()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseAngularVelocity ( AngularVelocity  v)
inlinenoexcept

Use the given angular velocity.

Definition at line 215 of file BodyConf.hpp.

◆ Use() [1/2]

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::Use ( Position  v)
inlinenoexcept

Use the given position for the linear and angular positions.

Examples
Body.cpp.

Definition at line 189 of file BodyConf.hpp.

◆ Use() [2/2]

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::Use ( Velocity  v)
inlinenoexcept

Use the given velocity for the linear and angular velocities.

Definition at line 196 of file BodyConf.hpp.

◆ UseLinearAcceleration()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseLinearAcceleration ( LinearAcceleration2  v)
inlinenoexcept

Use the given linear acceleration.

Examples
World.cpp.

Definition at line 209 of file BodyConf.hpp.

◆ UseAngularAcceleration()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseAngularAcceleration ( AngularAcceleration  v)
inlinenoexcept

Use the given angular acceleration.

Definition at line 221 of file BodyConf.hpp.

◆ UseLinearDamping()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseLinearDamping ( NonNegative< Frequency v)
inlinenoexcept

Use the given linear damping.

Definition at line 227 of file BodyConf.hpp.

◆ UseAngularDamping()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseAngularDamping ( NonNegative< Frequency v)
inlinenoexcept

Use the given angular damping.

Definition at line 233 of file BodyConf.hpp.

◆ UseUnderActiveTime()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseUnderActiveTime ( Time  v)
inlinenoexcept

Use the given under active time.

Definition at line 239 of file BodyConf.hpp.

◆ UseAllowSleep()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseAllowSleep ( bool  value)
inlinenoexcept

Use the given allow sleep value.

Definition at line 245 of file BodyConf.hpp.

◆ UseAwake()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseAwake ( bool  value)
inlinenoexcept

Use the given awake value.

Examples
Body.cpp.

Definition at line 251 of file BodyConf.hpp.

◆ UseFixedRotation()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseFixedRotation ( bool  value)
inlinenoexcept

Use the given fixed rotation state.

Examples
Body.cpp.

Definition at line 257 of file BodyConf.hpp.

◆ UseBullet()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseBullet ( bool  value)
inlinenoexcept

Use the given bullet state.

Definition at line 263 of file BodyConf.hpp.

◆ UseEnabled()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseEnabled ( bool  value)
inlinenoexcept

Use the given enabled state.

Definition at line 269 of file BodyConf.hpp.

◆ UseUserData()

PLAYRHO_CONSTEXPR BodyConf & playrho::d2::BodyConf::UseUserData ( void *  value)
inlinenoexcept

Use the given user data.

Definition at line 275 of file BodyConf.hpp.

Friends And Related Function Documentation

◆ GetDefaultBodyConf()

PLAYRHO_CONSTEXPR BodyConf GetDefaultBodyConf ( )
related

Gets the default body definition.

Definition at line 283 of file BodyConf.hpp.

Member Data Documentation

◆ type

BodyType playrho::d2::BodyConf::type = BodyType::Static

Type of the body: static, kinematic, or dynamic.

Note
If a dynamic body would have zero mass, the mass is set to one.
Examples
Body.cpp, and World.cpp.

Definition at line 110 of file BodyConf.hpp.

◆ location

Length2 playrho::d2::BodyConf::location = Length2{}

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

Examples
World.cpp.

Definition at line 114 of file BodyConf.hpp.

◆ angle

Angle playrho::d2::BodyConf::angle = 0_deg

The world angle of the body.

Definition at line 117 of file BodyConf.hpp.

◆ linearVelocity

LinearVelocity2 playrho::d2::BodyConf::linearVelocity = LinearVelocity2{}

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

Examples
World.cpp.

Definition at line 120 of file BodyConf.hpp.

◆ angularVelocity

AngularVelocity playrho::d2::BodyConf::angularVelocity = 0_rpm

The angular velocity of the body.

Definition at line 123 of file BodyConf.hpp.

◆ linearAcceleration

LinearAcceleration2 playrho::d2::BodyConf::linearAcceleration = LinearAcceleration2{}

Initial linear acceleration of the body.

Note
Usually this should be 0.
Examples
World.cpp.

Definition at line 127 of file BodyConf.hpp.

◆ angularAcceleration

AngularAcceleration playrho::d2::BodyConf::angularAcceleration = AngularAcceleration{0 * RadianPerSquareSecond}

Initial angular acceleration of the body.

Note
Usually this should be 0.

Definition at line 131 of file BodyConf.hpp.

◆ linearDamping

NonNegative<Frequency> playrho::d2::BodyConf::linearDamping = NonNegative<Frequency>{0_Hz}

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.

Definition at line 136 of file BodyConf.hpp.

◆ angularDamping

NonNegative<Frequency> playrho::d2::BodyConf::angularDamping = NonNegative<Frequency>{0_Hz}

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.

Definition at line 141 of file BodyConf.hpp.

◆ underActiveTime

Time playrho::d2::BodyConf::underActiveTime = 0_s

Under-active time.

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

Definition at line 146 of file BodyConf.hpp.

◆ allowSleep

bool playrho::d2::BodyConf::allowSleep = true

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

Definition at line 150 of file BodyConf.hpp.

◆ awake

bool playrho::d2::BodyConf::awake = true

Is this body initially awake or sleeping?

Definition at line 153 of file BodyConf.hpp.

◆ fixedRotation

bool playrho::d2::BodyConf::fixedRotation = false

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

Definition at line 156 of file BodyConf.hpp.

◆ bullet

bool playrho::d2::BodyConf::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.
Examples
World.cpp.

Definition at line 162 of file BodyConf.hpp.

◆ enabled

bool playrho::d2::BodyConf::enabled = true

Does this body start out enabled?

Definition at line 165 of file BodyConf.hpp.

◆ userData

void* playrho::d2::BodyConf::userData = nullptr

Use this to store application specific body data.

Definition at line 168 of file BodyConf.hpp.


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