Box2D
3.0.0
A Real-Time-Oriented 2-D Physics Engine
|
#include <Body.hpp>
Public Member Functions | |
constexpr | BodyDef ()=default |
This constructor sets the body definition default values. More... | |
constexpr BodyDef & | UseType (BodyType t) noexcept |
constexpr BodyDef & | UseLocation (Length2D l) noexcept |
constexpr BodyDef & | UseAngle (Angle a) noexcept |
constexpr BodyDef & | UseLinearVelocity (LinearVelocity2D v) noexcept |
constexpr BodyDef & | UseAngularVelocity (AngularVelocity v) noexcept |
constexpr BodyDef & | UseLinearAcceleration (LinearAcceleration2D v) noexcept |
constexpr BodyDef & | UseAngularAcceleration (AngularAcceleration v) noexcept |
constexpr BodyDef & | UseLinearDamping (RealNum v) noexcept |
constexpr BodyDef & | UseAngularDamping (RealNum v) noexcept |
constexpr BodyDef & | UseUnderActiveTime (Time v) noexcept |
constexpr BodyDef & | UseAllowSleep (bool value) noexcept |
constexpr BodyDef & | UseAwake (bool value) noexcept |
constexpr BodyDef & | UseFixedRotation (bool value) noexcept |
constexpr BodyDef & | UseBullet (bool value) noexcept |
constexpr BodyDef & | UseEnabled (bool value) noexcept |
constexpr BodyDef & | UseUserData (void *value) noexcept |
Public Attributes | |
BodyType | type = BodyType::Static |
The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one. More... | |
Length2D | position = Vec2_zero * Meter |
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes. More... | |
Angle | angle = Angle{0} |
The world angle of the body in radians. More... | |
LinearVelocity2D | linearVelocity = Vec2_zero * MeterPerSecond |
The linear velocity of the body's origin in world co-ordinates (in m/s). More... | |
AngularVelocity | angularVelocity = AngularVelocity{0} |
The angular velocity of the body. More... | |
LinearAcceleration2D | linearAcceleration = Vec2_zero * MeterPerSquareSecond |
AngularAcceleration | angularAcceleration = AngularAcceleration{0} |
RealNum | linearDamping = 0 |
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. More... | |
RealNum | angularDamping = 0 |
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. More... | |
Time | underActiveTime = Second * RealNum{0} |
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. More... | |
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 |
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 |
Does this body start out enabled? More... | |
void * | userData = nullptr |
Use this to store application specific body data. More... | |
Body Definition.
A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions.
|
default |
This constructor sets the body definition default values.
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
inlinenoexcept |
bool box2d::BodyDef::allowSleep = true |
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
AngularAcceleration box2d::BodyDef::angularAcceleration = AngularAcceleration{0} |
RealNum box2d::BodyDef::angularDamping = 0 |
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.
AngularVelocity box2d::BodyDef::angularVelocity = AngularVelocity{0} |
The angular velocity of the body.
bool box2d::BodyDef::awake = true |
Is this body initially awake or sleeping?
bool box2d::BodyDef::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.
bool box2d::BodyDef::enabled = true |
Does this body start out enabled?
bool box2d::BodyDef::fixedRotation = false |
Should this body be prevented from rotating? Useful for characters.
LinearAcceleration2D box2d::BodyDef::linearAcceleration = Vec2_zero * MeterPerSquareSecond |
RealNum box2d::BodyDef::linearDamping = 0 |
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.
LinearVelocity2D box2d::BodyDef::linearVelocity = Vec2_zero * MeterPerSecond |
The linear velocity of the body's origin in world co-ordinates (in m/s).
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
BodyType box2d::BodyDef::type = BodyType::Static |
The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.
Under-active time.
Set this to the value retrieved from Body::GetUnderActiveTime() or leave it as 0.
void* box2d::BodyDef::userData = nullptr |
Use this to store application specific body data.