Configuration for a body. More...
#include <BodyConf.hpp>
Public Member Functions | |
constexpr BodyConf & | UseType (BodyType t) noexcept |
Use the given type. | |
constexpr BodyConf & | UseLocation (Length2 l) noexcept |
Use the given location. | |
constexpr BodyConf & | UseAngle (Angle a) noexcept |
Use the given angle. | |
constexpr BodyConf & | UseLinearVelocity (LinearVelocity2 v) noexcept |
Use the given linear velocity. | |
constexpr BodyConf & | UseAngularVelocity (AngularVelocity v) noexcept |
Use the given angular velocity. | |
constexpr BodyConf & | Use (Position v) noexcept |
Use the given position for the linear and angular positions. | |
constexpr BodyConf & | Use (Velocity v) noexcept |
Use the given velocity for the linear and angular velocities. | |
constexpr BodyConf & | UseLinearAcceleration (LinearAcceleration2 v) noexcept |
Use the given linear acceleration. | |
constexpr BodyConf & | UseAngularAcceleration (AngularAcceleration v) noexcept |
Use the given angular acceleration. | |
constexpr BodyConf & | UseLinearDamping (NonNegative< Frequency > v) noexcept |
Use the given linear damping. | |
constexpr BodyConf & | UseAngularDamping (NonNegative< Frequency > v) noexcept |
Use the given angular damping. | |
constexpr BodyConf & | UseUnderActiveTime (Time v) noexcept |
Use the given under active time. | |
constexpr BodyConf & | UseAllowSleep (bool value) noexcept |
Use the given allow sleep value. | |
constexpr BodyConf & | UseAwake (bool value) noexcept |
Use the given awake value. | |
constexpr BodyConf & | UseFixedRotation (bool value) noexcept |
Use the given fixed rotation state. | |
constexpr BodyConf & | UseBullet (bool value) noexcept |
Use the given bullet state. | |
constexpr BodyConf & | UseEnabled (bool value) noexcept |
Use the given enabled state. | |
Public Attributes | |
BodyType | type = BodyType::Static |
Type of the body: static, kinematic, or dynamic. More... | |
Length2 | location = Length2{} |
The world location of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes. | |
Angle | angle = 0_deg |
The world angle of the body. | |
LinearVelocity2 | linearVelocity = LinearVelocity2{} |
The linear velocity of the body's origin in world co-ordinates (in m/s). | |
AngularVelocity | angularVelocity = 0_rpm |
The angular velocity of the body. | |
LinearAcceleration2 | linearAcceleration = LinearAcceleration2{} |
Initial linear acceleration of the body. More... | |
AngularAcceleration | angularAcceleration = AngularAcceleration{0 * RadianPerSquareSecond} |
Initial angular acceleration of the body. More... | |
NonNegative< Frequency > | 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. | |
NonNegative< Frequency > | 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. | |
Time | underActiveTime = 0_s |
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. | |
bool | awake = true |
Is the body awake or sleeping? | |
bool | fixedRotation = false |
Should this body be prevented from rotating? Useful for characters. | |
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 |
Whether or not the body is enabled. | |
Related Functions | |
(Note that these are not member functions.) | |
constexpr BodyConf | GetDefaultBodyConf () noexcept |
Gets the default body definition. | |
Transformation | GetTransformation (const BodyConf &conf) noexcept |
Gets the transformation associated with the given configuration. | |
constexpr Angle | GetAngle (const BodyConf &conf) noexcept |
Gets the angle of the given configuration. | |
constexpr bool | operator== (const BodyConf &lhs, const BodyConf &rhs) noexcept |
Operator equals. | |
constexpr bool | operator!= (const BodyConf &lhs, const BodyConf &rhs) noexcept |
Operator not-equals. | |
Configuration for a body.
A body configuration holds all the data needed to construct a rigid body. You can safely re-use body configurations.
World::CreateBody
method.AngularAcceleration playrho::d2::BodyConf::angularAcceleration = AngularAcceleration{0 * RadianPerSquareSecond} |
Initial angular acceleration of the body.
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.
LinearAcceleration2 playrho::d2::BodyConf::linearAcceleration = LinearAcceleration2{} |
BodyType playrho::d2::BodyConf::type = BodyType::Static |
Type of the body: static, kinematic, or dynamic.
Referenced by playrho::d2::GetBodyConf().
Time playrho::d2::BodyConf::underActiveTime = 0_s |
Under-active time.
Set this to the value retrieved from Body::GetUnderActiveTime
or leave it as 0.