PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::BodyConf Struct Reference

Configuration for a body. More...

#include <BodyConf.hpp>

Collaboration diagram for playrho::d2::BodyConf:
[legend]

Public Member Functions

constexpr BodyConfUseType (BodyType t) noexcept
 Use the given type.
 
constexpr BodyConfUseLocation (Length2 l) noexcept
 Use the given location.
 
constexpr BodyConfUseAngle (Angle a) noexcept
 Use the given angle.
 
constexpr BodyConfUseLinearVelocity (LinearVelocity2 v) noexcept
 Use the given linear velocity.
 
constexpr BodyConfUseAngularVelocity (AngularVelocity v) noexcept
 Use the given angular velocity.
 
constexpr BodyConfUse (Position v) noexcept
 Use the given position for the linear and angular positions.
 
constexpr BodyConfUse (Velocity v) noexcept
 Use the given velocity for the linear and angular velocities.
 
constexpr BodyConfUseLinearAcceleration (LinearAcceleration2 v) noexcept
 Use the given linear acceleration.
 
constexpr BodyConfUseAngularAcceleration (AngularAcceleration v) noexcept
 Use the given angular acceleration.
 
constexpr BodyConfUseLinearDamping (NonNegative< Frequency > v) noexcept
 Use the given linear damping.
 
constexpr BodyConfUseAngularDamping (NonNegative< Frequency > v) noexcept
 Use the given angular damping.
 
constexpr BodyConfUseUnderActiveTime (Time v) noexcept
 Use the given under active time.
 
constexpr BodyConfUseAllowSleep (bool value) noexcept
 Use the given allow sleep value.
 
constexpr BodyConfUseAwake (bool value) noexcept
 Use the given awake value.
 
constexpr BodyConfUseFixedRotation (bool value) noexcept
 Use the given fixed rotation state.
 
constexpr BodyConfUseBullet (bool value) noexcept
 Use the given bullet state.
 
constexpr BodyConfUseEnabled (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< FrequencylinearDamping = 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< FrequencyangularDamping = 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.
 

Detailed Description

Configuration for a body.

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, Body.
Examples
Body.cpp, DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, HelloWorld.cpp, MotorJoint.cpp, PrismaticJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, World.cpp, WorldBody.cpp, WorldContact.cpp, and WorldFixture.cpp.

Member Data Documentation

◆ angularAcceleration

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

Initial angular acceleration of the body.

Note
Usually this should be 0.

◆ 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.

◆ linearAcceleration

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

Initial linear acceleration of the body.

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

◆ 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
World.cpp, and WorldBody.cpp.

Referenced by playrho::d2::GetBodyConf().

◆ 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.


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