Configuration for a body. More...
#include <playrho/d2/BodyConf.hpp>
Public Member Functions | |
constexpr BodyConf & | Use (BodyType t) noexcept |
Use the given type. | |
constexpr BodyConf & | Use (const Position &v) noexcept |
Use the given position for the linear and angular positions. | |
constexpr BodyConf & | Use (const Sweep &v) noexcept |
Use the given sweep. | |
constexpr BodyConf & | Use (const Velocity &v) noexcept |
Use the given velocity for the linear and angular velocities. | |
constexpr BodyConf & | Use (ShapeID v) |
Appends the shape identifier to the collection to attach to the body. More... | |
constexpr BodyConf & | Use (Span< const ShapeID > v) |
Appends the shape identifiers to the collection to attach to the body. More... | |
constexpr BodyConf & | UseAllowSleep (bool value) noexcept |
Use the given allow sleep value. | |
constexpr BodyConf & | UseAngle (Angle a) noexcept |
Use the given angle. | |
constexpr BodyConf & | UseAngularAcceleration (AngularAcceleration v) noexcept |
Use the given angular acceleration. | |
constexpr BodyConf & | UseAngularDamping (NonNegative< Frequency > v) noexcept |
Use the given angular damping. | |
constexpr BodyConf & | UseAngularVelocity (AngularVelocity v) noexcept |
Use the given angular velocity. | |
constexpr BodyConf & | UseAwake (bool value) noexcept |
Use the given awake value. | |
constexpr BodyConf & | UseBullet (bool value) noexcept |
Use the given bullet state. | |
constexpr BodyConf & | UseEnabled (bool value) noexcept |
Use the given enabled state. | |
constexpr BodyConf & | UseFixedRotation (bool value) noexcept |
Use the given fixed rotation state. | |
constexpr BodyConf & | UseInvMass (const NonNegative< InvMass > &v) noexcept |
Use the given inverse mass. | |
constexpr BodyConf & | UseInvRotI (const NonNegative< InvRotInertia > &v) noexcept |
Use the given inverse rotational inertia. | |
constexpr BodyConf & | UseLinearAcceleration (const LinearAcceleration2 &v) noexcept |
Use the given linear acceleration. | |
constexpr BodyConf & | UseLinearDamping (NonNegative< Frequency > v) noexcept |
Use the given linear damping. | |
constexpr BodyConf & | UseLinearVelocity (const LinearVelocity2 &v) noexcept |
Use the given linear velocity. | |
constexpr BodyConf & | UseLocation (const Length2 &l) noexcept |
Use the given location. | |
constexpr BodyConf & | UseMassDataDirty (bool v) noexcept |
Use the given mass data dirty state. | |
constexpr BodyConf & | UseUnderActiveTime (Time v) noexcept |
Use the given under active time. | |
Static Public Attributes | |
static constexpr auto | DefaultAllowSleep = true |
Default allow sleep. | |
static constexpr auto | DefaultAngularAcceleration |
Default angular acceleration. More... | |
static constexpr auto | DefaultAngularDamping = NonNegativeFF<Frequency>{0_Hz} |
Default angular damping. | |
static constexpr auto | DefaultAngularVelocity = 0_rpm |
Default angular velocity. | |
static constexpr auto | DefaultAwake = true |
Default awake value. | |
static constexpr auto | DefaultBodyType = BodyType::Static |
Default body type. | |
static constexpr auto | DefaultBullet = false |
Default bullet value. | |
static constexpr auto | DefaultEnabled = true |
Default enabled value. | |
static constexpr auto | DefaultFixedRotation = false |
Default fixed rotation value. | |
static constexpr auto | DefaultInvMass |
Default inverse mass. More... | |
static constexpr auto | DefaultInvRotI |
Default inverse rotational inertia. More... | |
static constexpr auto | DefaultLinearAcceleration = LinearAcceleration2{} |
Default linear acceleration. | |
static constexpr auto | DefaultLinearDamping = NonNegativeFF<Frequency>{0_Hz} |
Default linear damping. | |
static constexpr auto | DefaultLinearVelocity = LinearVelocity2{} |
Default linear velocity. | |
static constexpr auto | DefaultMassDataDirty = true |
Default mass data dirty value. | |
static constexpr auto | DefaultSweep = Sweep{} |
Default sweep. | |
static constexpr auto | DefaultUnderActiveTime = 0_s |
Default under active time. | |
static constexpr auto | MaxShapes = std::size_t(128) |
Max associable shapes. | |
Related Functions | |
(Note that these are not member functions.) | |
constexpr auto | GetAngle (const BodyConf &conf) noexcept -> Angle |
Gets the angle of the given configuration. | |
constexpr BodyConf | GetDefaultBodyConf () noexcept |
Gets the default body definition. | |
constexpr auto | GetLocation (const BodyConf &conf) noexcept -> Length2 |
Gets the location of the given configuration. | |
constexpr bool | operator!= (const BodyConf &lhs, const BodyConf &rhs) noexcept |
Operator not-equals. | |
constexpr bool | operator== (const BodyConf &lhs, const BodyConf &rhs) noexcept |
Operator 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.
Body
construction. Appends the shape identifier to the collection to attach to the body.
LengthError | if operation would exceed MaxShapes . Provides the strong exception guarantee - i.e. state is as it was before this was called. |
shapes
holds the given value. Appends the shape identifiers to the collection to attach to the body.
LengthError | if operation would exceed MaxShapes . Provides the strong exception guarantee - i.e. state is as it was before this was called. |
shapes
holds the given values in the same order as given. bool playrho::d2::BodyConf::allowSleep = DefaultAllowSleep |
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
AngularAcceleration playrho::d2::BodyConf::angularAcceleration = DefaultAngularAcceleration |
Initial angular acceleration of the body.
NonNegative<Frequency> playrho::d2::BodyConf::angularDamping = DefaultAngularDamping |
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.
bool playrho::d2::BodyConf::bullet = DefaultBullet |
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.
|
staticconstexpr |
Default angular acceleration.
|
staticconstexpr |
Default inverse mass.
|
staticconstexpr |
Default inverse rotational inertia.
NonNegative<InvMass> playrho::d2::BodyConf::invMass = DefaultInvMass |
Inverse mass for the body.
NonNegative<InvRotInertia> playrho::d2::BodyConf::invRotI = DefaultInvRotI |
Inverse rotational inertia for the body.
LinearAcceleration2 playrho::d2::BodyConf::linearAcceleration = DefaultLinearAcceleration |
Initial linear acceleration of the body.
NonNegative<Frequency> playrho::d2::BodyConf::linearDamping = DefaultLinearDamping |
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.
Sweep playrho::d2::BodyConf::sweep = DefaultSweep |
The sweep of the body.
This establishes a body's location and angle.
BodyType playrho::d2::BodyConf::type = DefaultBodyType |
Type of the body: static, kinematic, or dynamic.
Referenced by playrho::d2::Body::GetBodyConf().
Time playrho::d2::BodyConf::underActiveTime = DefaultUnderActiveTime |
Under-active time.
Set this to the value retrieved from Body::GetUnderActiveTime
or leave it as 0.