#include <BodyConf.hpp>
Public Member Functions | |
PLAYRHO_CONSTEXPR BodyConf & | UseType (BodyType t) noexcept |
Use the given type. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseLocation (Length2 l) noexcept |
Use the given location. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseAngle (Angle a) noexcept |
Use the given angle. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseLinearVelocity (LinearVelocity2 v) noexcept |
Use the given linear velocity. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseAngularVelocity (AngularVelocity v) noexcept |
Use the given angular velocity. More... | |
PLAYRHO_CONSTEXPR BodyConf & | Use (Position v) noexcept |
Use the given position for the linear and angular positions. More... | |
PLAYRHO_CONSTEXPR BodyConf & | Use (Velocity v) noexcept |
Use the given velocity for the linear and angular velocities. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseLinearAcceleration (LinearAcceleration2 v) noexcept |
Use the given linear acceleration. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseAngularAcceleration (AngularAcceleration v) noexcept |
Use the given angular acceleration. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseLinearDamping (NonNegative< Frequency > v) noexcept |
Use the given linear damping. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseAngularDamping (NonNegative< Frequency > v) noexcept |
Use the given angular damping. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseUnderActiveTime (Time v) noexcept |
Use the given under active time. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseAllowSleep (bool value) noexcept |
Use the given allow sleep value. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseAwake (bool value) noexcept |
Use the given awake value. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseFixedRotation (bool value) noexcept |
Use the given fixed rotation state. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseBullet (bool value) noexcept |
Use the given bullet state. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseEnabled (bool value) noexcept |
Use the given enabled state. More... | |
PLAYRHO_CONSTEXPR BodyConf & | UseUserData (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< Frequency > | linearDamping = NonNegative<Frequency>{0_Hz} |
NonNegative< Frequency > | angularDamping = 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()
|
inlinenoexcept |
Use the given type.
- Examples
- Body.cpp, Contact.cpp, and World.cpp.
Definition at line 171 of file BodyConf.hpp.
◆ UseLocation()
|
inlinenoexcept |
Use the given location.
- Examples
- HelloWorld.cpp, and World.cpp.
Definition at line 177 of file BodyConf.hpp.
◆ UseAngle()
|
inlinenoexcept |
Use the given angle.
Definition at line 183 of file BodyConf.hpp.
◆ UseLinearVelocity()
|
inlinenoexcept |
Use the given linear velocity.
Definition at line 203 of file BodyConf.hpp.
◆ UseAngularVelocity()
|
inlinenoexcept |
Use the given angular velocity.
Definition at line 215 of file BodyConf.hpp.
◆ Use() [1/2]
|
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]
|
inlinenoexcept |
Use the given velocity for the linear and angular velocities.
Definition at line 196 of file BodyConf.hpp.
◆ UseLinearAcceleration()
|
inlinenoexcept |
◆ UseAngularAcceleration()
|
inlinenoexcept |
Use the given angular acceleration.
Definition at line 221 of file BodyConf.hpp.
◆ UseLinearDamping()
|
inlinenoexcept |
Use the given linear damping.
Definition at line 227 of file BodyConf.hpp.
◆ UseAngularDamping()
|
inlinenoexcept |
Use the given angular damping.
Definition at line 233 of file BodyConf.hpp.
◆ UseUnderActiveTime()
|
inlinenoexcept |
Use the given under active time.
Definition at line 239 of file BodyConf.hpp.
◆ UseAllowSleep()
|
inlinenoexcept |
Use the given allow sleep value.
Definition at line 245 of file BodyConf.hpp.
◆ UseAwake()
|
inlinenoexcept |
◆ UseFixedRotation()
|
inlinenoexcept |
◆ UseBullet()
|
inlinenoexcept |
Use the given bullet state.
Definition at line 263 of file BodyConf.hpp.
◆ UseEnabled()
|
inlinenoexcept |
Use the given enabled state.
Definition at line 269 of file BodyConf.hpp.
◆ UseUserData()
|
inlinenoexcept |
Use the given user data.
Definition at line 275 of file BodyConf.hpp.
Friends And Related Function Documentation
◆ 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.
Definition at line 110 of file BodyConf.hpp.
◆ location
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:
- Dynamics/BodyConf.hpp