Physical entity that exists within a World. More...
#include <Body.hpp>
Public Types | |
enum | Flag : FlagsType { e_islandFlag = FlagsType(0x0001), e_awakeFlag = FlagsType(0x0002), e_autoSleepFlag = FlagsType(0x0004), e_impenetrableFlag = FlagsType(0x0008), e_fixedRotationFlag = FlagsType(0x0010), e_enabledFlag = FlagsType(0x0020), e_velocityFlag = FlagsType(0x0080), e_accelerationFlag = FlagsType(0x0100), e_massDataDirtyFlag = FlagsType(0x0200) } |
Flag enumeration. More... | |
using | Fixtures = std::vector< Fixture * > |
Container type for fixtures. More... | |
using | KeyedJointPtr = std::pair< Body *, Joint * > |
Keyed joint pointer. More... | |
using | Joints = std::vector< KeyedJointPtr > |
Container type for joints. More... | |
using | Contacts = std::vector< KeyedContactPtr > |
Container type for contacts. More... | |
using | FlagsType = std::uint16_t |
Flags type. More... | |
Public Member Functions | |
Fixture * | CreateFixture (const Shape &shape, const FixtureConf &def=GetDefaultFixtureConf(), bool resetMassData=true) |
Creates a fixture and attaches it to this body. More... | |
bool | Destroy (Fixture *fixture, bool resetMassData=true) |
Destroys a fixture. More... | |
void | DestroyFixtures () |
Destroys fixtures. More... | |
void | SetTransform (Length2 location, Angle angle) |
Sets the position of the body's origin and rotation. More... | |
Transformation | GetTransformation () const noexcept |
Gets the body transform for the body's origin. More... | |
Length2 | GetLocation () const noexcept |
Gets the world body origin location. More... | |
const Sweep & | GetSweep () const noexcept |
Gets the body's sweep. More... | |
Angle | GetAngle () const noexcept |
Get the angle. More... | |
Length2 | GetWorldCenter () const noexcept |
Get the world position of the center of mass. More... | |
Length2 | GetLocalCenter () const noexcept |
Gets the local position of the center of mass. More... | |
Velocity | GetVelocity () const noexcept |
Gets the velocity. More... | |
void | SetVelocity (const Velocity &velocity) noexcept |
Sets the body's velocity (linear and angular velocity). More... | |
void | SetAcceleration (LinearAcceleration2 linear, AngularAcceleration angular) noexcept |
Sets the linear and rotational accelerations on this body. More... | |
LinearAcceleration2 | GetLinearAcceleration () const noexcept |
Gets this body's linear acceleration. More... | |
AngularAcceleration | GetAngularAcceleration () const noexcept |
Gets this body's angular acceleration. More... | |
InvMass | GetInvMass () const noexcept |
Gets the inverse total mass of the body. More... | |
InvRotInertia | GetInvRotInertia () const noexcept |
Gets the inverse rotational inertia of the body. More... | |
void | SetMassData (const MassData &massData) |
Set the mass properties to override the mass properties of the fixtures. More... | |
void | ResetMassData () |
Resets the mass data properties. More... | |
Frequency | GetLinearDamping () const noexcept |
Gets the linear damping of the body. More... | |
void | SetLinearDamping (NonNegative< Frequency > linearDamping) noexcept |
Sets the linear damping of the body. More... | |
Frequency | GetAngularDamping () const noexcept |
Gets the angular damping of the body. More... | |
void | SetAngularDamping (NonNegative< Frequency > angularDamping) noexcept |
Sets the angular damping of the body. More... | |
void | SetType (BodyType type) |
Sets the type of this body. More... | |
BodyType | GetType () const noexcept |
Gets the type of this body. More... | |
bool | IsSpeedable () const noexcept |
Is "speedable". More... | |
bool | IsAccelerable () const noexcept |
Is "accelerable". More... | |
void | SetBullet (bool flag) noexcept |
Sets the bullet status of this body. More... | |
bool | IsImpenetrable () const noexcept |
Is this body treated like a bullet for continuous collision detection? More... | |
void | SetSleepingAllowed (bool flag) noexcept |
bool | IsSleepingAllowed () const noexcept |
Gets whether or not this body allowed to sleep. More... | |
void | SetAwake () noexcept |
Awakens this body. More... | |
void | UnsetAwake () noexcept |
Sets this body to asleep if sleeping is allowed. More... | |
bool | IsAwake () const noexcept |
Gets the awake/asleep state of this body. More... | |
Time | GetUnderActiveTime () const noexcept |
Gets this body's under-active time value. More... | |
void | SetUnderActiveTime (Time value) noexcept |
Sets the "under-active" time to the given value. More... | |
void | ResetUnderActiveTime () noexcept |
Resets the under-active time for this body. More... | |
void | SetEnabled (bool flag) |
Sets the enabled state of the body. More... | |
bool | IsEnabled () const noexcept |
Gets the enabled/disabled state of the body. More... | |
void | SetFixedRotation (bool flag) |
Sets this body to have fixed rotation. More... | |
bool | IsFixedRotation () const noexcept |
Does this body have fixed rotation? More... | |
SizedRange< Fixtures::const_iterator > | GetFixtures () const noexcept |
Gets the range of all constant fixtures attached to this body. More... | |
SizedRange< Fixtures::iterator > | GetFixtures () noexcept |
Gets the range of all fixtures attached to this body. More... | |
SizedRange< Joints::const_iterator > | GetJoints () const noexcept |
Gets the range of all joints attached to this body. More... | |
SizedRange< Joints::iterator > | GetJoints () noexcept |
Gets the range of all joints attached to this body. More... | |
SizedRange< Contacts::const_iterator > | GetContacts () const noexcept |
Gets the container of all contacts attached to this body. More... | |
void * | GetUserData () const noexcept |
Gets the user data pointer that was provided in the body definition. More... | |
void | SetUserData (void *data) noexcept |
Sets the user data. Use this to store your application specific data. More... | |
World * | GetWorld () const noexcept |
Gets the parent world of this body. More... | |
bool | IsMassDataDirty () const noexcept |
Gets whether the mass data for this body is "dirty". More... | |
Static Public Member Functions | |
static FlagsType | GetFlags (BodyType type) noexcept |
Gets the flags for the given value. More... | |
static FlagsType | GetFlags (const BodyConf &bd) noexcept |
Gets the flags for the given value. More... | |
Static Public Attributes | |
static const PLAYRHO_CONSTEXPR auto | InvalidIslandIndex = static_cast<BodyCounter>(-1) |
Invalid island index. More... | |
Friends | |
class | BodyAtty |
Related Functions | |
(Note that these are not member functions.) | |
AABB | ComputeAABB (const Body &body) |
Computes the AABB for the given body. More... | |
MassData | ComputeMassData (const Body &body) noexcept |
Computes the body's mass data. More... | |
MassData | GetMassData (const Body &body) noexcept |
Gets the mass data of the body. More... | |
Acceleration | GetAcceleration (const Body &body) noexcept |
Gets the given body's acceleration. More... | |
void | SetAcceleration (Body &body, Acceleration value) noexcept |
Sets the accelerations on the given body. More... | |
Acceleration | CalcGravitationalAcceleration (const Body &body) noexcept |
Calculates the gravitationally associated acceleration for the given body within its world. More... | |
bool | Awaken (Body &body) noexcept |
Awakens the body if it's asleep. More... | |
bool | Unawaken (Body &body) noexcept |
Puts the body to sleep if it's awake. More... | |
bool | ShouldCollide (const Body &lhs, const Body &rhs) noexcept |
Should collide. More... | |
Position | GetPosition1 (const Body &body) noexcept |
Gets the "position 1" Position information for the given body. More... | |
Mass | GetMass (const Body &body) noexcept |
Gets the mass of the body. More... | |
void | SetLinearAcceleration (Body &body, LinearAcceleration2 value) noexcept |
Sets the given linear acceleration of the given body. More... | |
void | SetAngularAcceleration (Body &body, AngularAcceleration value) noexcept |
Sets the given angular acceleration of the given body. More... | |
void | ApplyLinearAcceleration (Body &body, LinearAcceleration2 amount) |
Applies the given linear acceleration to the given body. More... | |
void | SetForce (Body &body, Force2 force, Length2 point) noexcept |
Sets the given amount of force at the given point to the given body. More... | |
void | ApplyForce (Body &body, Force2 force, Length2 point) noexcept |
Apply a force at a world point. More... | |
void | ApplyForceToCenter (Body &body, Force2 force) noexcept |
Apply a force to the center of mass. More... | |
void | SetTorque (Body &body, Torque torque) noexcept |
Sets the given amount of torque to the given body. More... | |
void | ApplyTorque (Body &body, Torque torque) noexcept |
Applies a torque. More... | |
void | ApplyLinearImpulse (Body &body, Momentum2 impulse, Length2 point) noexcept |
Applies an impulse at a point. More... | |
void | ApplyAngularImpulse (Body &body, AngularMomentum impulse) noexcept |
Applies an angular impulse. More... | |
Force2 | GetCentripetalForce (const Body &body, Length2 axis) |
Gets the centripetal force necessary to put the body into an orbit having the given radius. More... | |
RotInertia | GetRotInertia (const Body &body) noexcept |
Gets the rotational inertia of the body. More... | |
RotInertia | GetLocalRotInertia (const Body &body) noexcept |
Gets the rotational inertia of the body about the local origin. More... | |
LinearVelocity2 | GetLinearVelocity (const Body &body) noexcept |
Gets the linear velocity of the center of mass. More... | |
AngularVelocity | GetAngularVelocity (const Body &body) noexcept |
Gets the angular velocity. More... | |
void | SetLinearVelocity (Body &body, const LinearVelocity2 v) noexcept |
Sets the linear velocity of the center of mass. More... | |
void | SetAngularVelocity (Body &body, AngularVelocity omega) noexcept |
Sets the angular velocity. More... | |
Length2 | GetWorldPoint (const Body &body, const Length2 localPoint) noexcept |
Gets the world coordinates of a point given in coordinates relative to the body's origin. More... | |
Length2 | GetWorldVector (const Body &body, const Length2 localVector) noexcept |
Gets the world coordinates of a vector given the local coordinates. More... | |
UnitVec | GetWorldVector (const Body &body, const UnitVec localVector) noexcept |
Gets the world vector for the given local vector from the given body's transformation. More... | |
Length2 | GetLocalPoint (const Body &body, const Length2 worldPoint) noexcept |
Gets a local point relative to the body's origin given a world point. More... | |
UnitVec | GetLocalVector (const Body &body, const UnitVec uv) noexcept |
Gets a locally oriented unit vector given a world oriented unit vector. More... | |
LinearVelocity2 | GetLinearVelocityFromWorldPoint (const Body &body, const Length2 worldPoint) noexcept |
Gets the linear velocity from a world point attached to this body. More... | |
LinearVelocity2 | GetLinearVelocityFromLocalPoint (const Body &body, const Length2 localPoint) noexcept |
Gets the linear velocity from a local point. More... | |
Force2 | GetForce (const Body &body) noexcept |
Gets the net force that the given body is currently experiencing. More... | |
Torque | GetTorque (const Body &body) noexcept |
Gets the net torque that the given body is currently experiencing. More... | |
Velocity | GetVelocity (const Body &body, Time h) noexcept |
Gets the velocity of the body after the given time accounting for the body's acceleration and capped by the given configuration. More... | |
BodyCounter | GetWorldIndex (const Body *body) noexcept |
Gets the world index for the given body. More... | |
std::size_t | GetFixtureCount (const Body &body) noexcept |
Gets the fixture count of the given body. More... | |
void | RotateAboutWorldPoint (Body &body, Angle amount, Length2 worldPoint) |
Rotates a body a given amount around a point in world coordinates. More... | |
void | RotateAboutLocalPoint (Body &body, Angle amount, Length2 localPoint) |
Rotates a body a given amount around a point in body local coordinates. More... | |
Length2 | GetLocation (const Body &body) noexcept |
Gets the body's origin location. More... | |
Angle | GetAngle (const Body &body) noexcept |
Gets the body's angle. More... | |
void | SetLocation (Body &body, Length2 value) noexcept |
Sets the body's location. More... | |
void | SetAngle (Body &body, Angle value) noexcept |
Sets the body's angular orientation. More... | |
BodyConf | GetBodyConf (const Body &body) noexcept |
Gets the body definition for the given body. More... | |
Detailed Description
Physical entity that exists within a World.
A rigid body entity created or destroyed through a World instance. These have physical properties like: position, velocity, acceleration, and mass.
- Invariant
- Only bodies that allow sleeping, can be put to sleep.
- Only "speedable" bodies can be awake.
- Only "speedable" bodies can have non-zero velocities.
- Only "accelerable" bodies can have non-zero accelerations.
- Only "accelerable" bodies can have non-zero "under-active" times.
- Note
- Create these using the
World::CreateBody
method. -
Destroy these using the
World::Destroy(Body*)
method. - From a memory management perspective, bodies own Fixture instances.
- On a 64-bit architecture with 4-byte Real, this data structure is at least 192-bytes large.
Member Typedef Documentation
◆ Fixtures
using playrho::d2::Body::Fixtures = std::vector<Fixture*> |
◆ KeyedJointPtr
using playrho::d2::Body::KeyedJointPtr = std::pair<Body*, Joint*> |
◆ Joints
using playrho::d2::Body::Joints = std::vector<KeyedJointPtr> |
◆ Contacts
using playrho::d2::Body::Contacts = std::vector<KeyedContactPtr> |
◆ FlagsType
using playrho::d2::Body::FlagsType = std::uint16_t |
Member Enumeration Documentation
◆ Flag
enum playrho::d2::Body::Flag : FlagsType |
Flag enumeration.
- Note
- For internal use. Made public to facilitate unit testing.
Enumerator | |
---|---|
e_islandFlag | Island flag. |
e_awakeFlag | Awake flag. |
e_autoSleepFlag | Auto sleep flag. |
e_impenetrableFlag | Impenetrable flag. Indicates whether CCD should be done for this body. All static and kinematic bodies have this flag enabled. |
e_fixedRotationFlag | Fixed rotation flag. |
e_enabledFlag | Enabled flag. |
e_velocityFlag | Velocity flag. Set this to enable changes in position due to velocity. Bodies with this set are "speedable" - either kinematic or dynamic bodies. |
e_accelerationFlag | Acceleration flag. Set this to enable changes in velocity due to physical properties (like forces). Bodies with this set are "accelerable" - dynamic bodies. |
e_massDataDirtyFlag | Mass Data Dirty Flag. |
Member Function Documentation
◆ GetFlags() [1/2]
|
inlinestaticnoexcept |
◆ GetFlags() [2/2]
|
staticnoexcept |
◆ CreateFixture()
Fixture * playrho::d2::Body::CreateFixture | ( | const Shape & | shape, |
const FixtureConf & | def = GetDefaultFixtureConf() , |
||
bool | resetMassData = true |
||
) |
Creates a fixture and attaches it to this body.
Creates a fixture for attaching a shape and other characteristics to this body. Fixtures automatically go away when this body is destroyed. Fixtures can also be manually removed and destroyed using the Destroy(Fixture*, bool)
, or DestroyFixtures()
methods.
- Note
- This function should not be called if the world is locked.
- Warning
- This function is locked during callbacks.
- Postcondition
- After creating a new fixture, it will show up in the fixture enumeration returned by the
GetFixtures()
methods.
- Parameters
-
shape Shareable shape definition. Its vertex radius must be less than the minimum or more than the maximum allowed by the body's world. def Initial fixture settings. Friction and density must be >= 0. Restitution must be > -infinity and < infinity. resetMassData Whether or not to reset the mass data of the body.
- Returns
- Pointer to the created fixture.
- Exceptions
-
WrongState if called while the world is "locked". InvalidArgument if called for a shape with a vertex radius less than the minimum vertex radius. InvalidArgument if called for a shape with a vertex radius greater than the maximum vertex radius.
- See also
- Destroy, GetFixtures
- Physical Entity Classes
- Examples
- Contact.cpp, and World.cpp.
◆ Destroy()
bool playrho::d2::Body::Destroy | ( | Fixture * | fixture, |
bool | resetMassData = true |
||
) |
Destroys a fixture.
Destroys a fixture previously created by the CreateFixture(const Shape&, const FixtureConf&, bool)
method. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. All fixtures attached to a body are implicitly destroyed when the body is destroyed.
- Warning
- This function is locked during callbacks.
- Note
- Make sure to explicitly call
ResetMassData()
after fixtures have been destroyed if resetting the mass data is not requested via the reset mass data parameter.
- Postcondition
- After destroying a fixture, it will no longer show up in the fixture enumeration returned by the
GetFixtures()
methods.
- Parameters
-
fixture the fixture to be removed. resetMassData Whether or not to reset the mass data.
◆ DestroyFixtures()
void playrho::d2::Body::DestroyFixtures | ( | ) |
Destroys fixtures.
Destroys all of the fixtures previously created for this body by the CreateFixture(const Shape&, const FixtureConf&, bool)
method.
- Note
- This unconditionally calls the
ResetMassData()
method.
- Postcondition
- After this call, no fixtures will show up in the fixture enumeration returned by the
GetFixtures()
methods.
◆ SetTransform()
Sets the position of the body's origin and rotation.
This instantly adjusts the body to be at the new position and new orientation.
- Warning
- Manipulating a body's transform can cause non-physical behavior!
- Note
- Contacts are updated on the next call to World::Step.
- Parameters
-
location Valid world location of the body's local origin. Behavior is undefined if value is invalid. angle Valid world rotation. Behavior is undefined if value is invalid.
◆ GetTransformation()
|
inlinenoexcept |
Gets the body transform for the body's origin.
- Returns
- the world transform of the body's origin.
- See also
- GetLocation.
◆ GetLocation()
|
inlinenoexcept |
Gets the world body origin location.
This is the location of the body's origin relative to its world. The location of the body after stepping the world's physics simulations is dependent on a number of factors:
- Location at the last time step.
- Forces acting on the body (gravity, applied force, applied impulse).
- The mass data of the body.
- Damping of the body.
- Restitution and friction values of the body's fixtures when they experience collisions.
- Returns
- World location of the body's origin.
- See also
- GetTransformation.
◆ GetSweep()
|
inlinenoexcept |
◆ GetAngle()
|
inlinenoexcept |
◆ GetWorldCenter()
|
inlinenoexcept |
◆ GetLocalCenter()
|
inlinenoexcept |
◆ GetVelocity()
|
inlinenoexcept |
◆ SetVelocity()
|
noexcept |
Sets the body's velocity (linear and angular velocity).
- Note
- This method does nothing if this body is not speedable.
- A non-zero velocity will awaken this body.
- See also
- SetAwake, SetUnderActiveTime.
◆ SetAcceleration()
|
noexcept |
◆ GetLinearAcceleration()
|
inlinenoexcept |
◆ GetAngularAcceleration()
|
inlinenoexcept |
◆ GetInvMass()
|
inlinenoexcept |
Gets the inverse total mass of the body.
This is the cached result of dividing 1 by the body's mass. Often floating division is much slower than multiplication. As such, it's likely faster to multiply values by this inverse value than to redivide them all the time by the mass.
- Returns
- Value of zero or more representing the body's inverse mass (in 1/kg).
- See also
- SetMassData.
◆ GetInvRotInertia()
|
inlinenoexcept |
Gets the inverse rotational inertia of the body.
This is the cached result of dividing 1 by the body's rotational inertia. Often floating division is much slower than multiplication. As such, it's likely faster to multiply values by this inverse value than to redivide them all the time by the rotational inertia.
- Returns
- Inverse rotational inertia (in 1/kg-m^2).
◆ SetMassData()
void playrho::d2::Body::SetMassData | ( | const MassData & | massData | ) |
Set the mass properties to override the mass properties of the fixtures.
- Note
- This changes the center of mass position.
- Creating or destroying fixtures can also alter the mass.
- This function has no effect if the body isn't dynamic.
- Parameters
-
massData the mass properties.
◆ ResetMassData()
void playrho::d2::Body::ResetMassData | ( | ) |
Resets the mass data properties.
This resets the mass data to the sum of the mass properties of the fixtures.
- Note
- This method must be called after calling
CreateFixture
to update the body mass data properties unlessSetMassData
is used.
- See also
- SetMassData.
◆ GetLinearDamping()
|
inlinenoexcept |
◆ SetLinearDamping()
|
inlinenoexcept |
◆ GetAngularDamping()
|
inlinenoexcept |
◆ SetAngularDamping()
|
inlinenoexcept |
◆ SetType()
void playrho::d2::Body::SetType | ( | playrho::BodyType | type | ) |
◆ GetType()
|
inlinenoexcept |
◆ IsSpeedable()
|
inlinenoexcept |
◆ IsAccelerable()
|
inlinenoexcept |
◆ SetBullet()
|
inlinenoexcept |
◆ IsImpenetrable()
|
inlinenoexcept |
◆ SetSleepingAllowed()
|
inlinenoexcept |
◆ IsSleepingAllowed()
|
inlinenoexcept |
◆ SetAwake()
|
inlinenoexcept |
Awakens this body.
Sets this body to awake and resets its under-active time if it's a "speedable" body. This method has no effect otherwise.
- Postcondition
- If this body is a "speedable" body, then this body's
IsAwake
method returns true. -
If this body is a "speedable" body, then this body's
GetUnderActiveTime
method returns zero.
◆ UnsetAwake()
|
inlinenoexcept |
Sets this body to asleep if sleeping is allowed.
If this body is allowed to sleep, this: sets the sleep state of the body to asleep, resets this body's under active time, and resets this body's velocity (linear and angular).
- Postcondition
- This body's
IsAwake
method returns false. -
This body's
GetUnderActiveTime
method returns zero. -
This body's
GetVelocity
method returns zero linear and zero angular speed.
◆ IsAwake()
|
inlinenoexcept |
◆ GetUnderActiveTime()
|
inlinenoexcept |
◆ SetUnderActiveTime()
|
inlinenoexcept |
Sets the "under-active" time to the given value.
Sets the "under-active" time to a value of zero or a non-zero value if the body is "accelerable". Otherwise it does nothing.
- Warning
- Behavior is undefined for negative values.
- Note
- A non-zero time is only valid for an "accelerable" body.
◆ ResetUnderActiveTime()
|
inlinenoexcept |
◆ SetEnabled()
void playrho::d2::Body::SetEnabled | ( | bool | flag | ) |
Sets the enabled state of the body.
A disabled body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected.
- Note
- A disabled body is still owned by a World object and remains in the world's body container.
- You may continue to create/destroy fixtures and joints on disabled bodies.
- Fixtures on a disabled body are implicitly disabled and will not participate in collisions, ray-casts, or queries.
- Joints connected to a disabled body are implicitly disabled.
◆ IsEnabled()
|
inlinenoexcept |
◆ SetFixedRotation()
void playrho::d2::Body::SetFixedRotation | ( | bool | flag | ) |
◆ IsFixedRotation()
|
inlinenoexcept |
◆ GetFixtures() [1/2]
|
inlinenoexcept |
◆ GetFixtures() [2/2]
|
noexcept |
Gets the range of all fixtures attached to this body.
◆ GetJoints() [1/2]
|
inlinenoexcept |
◆ GetJoints() [2/2]
|
noexcept |
Gets the range of all joints attached to this body.
◆ GetContacts()
|
inlinenoexcept |
Gets the container of all contacts attached to this body.
- Warning
- This collection changes during the time step and you may miss some collisions if you don't use
ContactListener
.
◆ GetUserData()
|
inlinenoexcept |
◆ SetUserData()
|
inlinenoexcept |
◆ GetWorld()
|
inlinenoexcept |
◆ IsMassDataDirty()
|
inlinenoexcept |
Friends And Related Function Documentation
◆ BodyAtty
◆ ComputeAABB()
◆ ComputeMassData()
Computes the body's mass data.
This basically accumulates the mass data over all fixtures.
- Note
- The center is the mass weighted sum of all fixture centers. Divide it by the mass to get the averaged center.
- Returns
- accumulated mass data for all fixtures associated with the given body.
Definition at line 187 of file MassData.cpp.
◆ GetMassData()
Gets the mass data of the body.
- Returns
- Data structure containing the mass, inertia, and center of the body.
Definition at line 206 of file MassData.cpp.
◆ GetAcceleration()
|
related |
◆ SetAcceleration()
|
related |
Sets the accelerations on the given body.
- Note
- This has no effect on non-accelerable bodies.
- A non-zero acceleration will also awaken the body.
- Parameters
-
body Body whose acceleration should be set. value Acceleration value to set.
◆ CalcGravitationalAcceleration()
|
related |
◆ Awaken()
|
related |
◆ Unawaken()
|
related |
◆ ShouldCollide()
◆ GetPosition1()
◆ GetMass()
Gets the mass of the body.
- Note
- This may be the total calculated mass or it may be the set mass of the body.
- Returns
- Value of zero or more representing the body's mass.
- See also
- GetInvMass, SetMassData
◆ SetLinearAcceleration()
|
related |
◆ SetAngularAcceleration()
|
related |
◆ ApplyLinearAcceleration()
|
related |
◆ SetForce()
◆ ApplyForce()
◆ ApplyForceToCenter()
◆ SetTorque()
◆ ApplyTorque()
◆ ApplyLinearImpulse()
Applies an impulse at a point.
- Note
- This immediately modifies the velocity.
- This also modifies the angular velocity if the point of application is not at the center of mass.
- Non-zero impulses wakes up the body.
- Parameters
-
body Body to apply the impulse to. impulse the world impulse vector. point the world position of the point of application.
◆ ApplyAngularImpulse()
|
related |
◆ GetCentripetalForce()
◆ GetRotInertia()
|
related |
◆ GetLocalRotInertia()
|
related |
◆ GetLinearVelocity()
|
related |
◆ GetAngularVelocity()
|
related |
◆ SetLinearVelocity()
|
related |
◆ SetAngularVelocity()
|
related |
◆ GetWorldPoint()
Gets the world coordinates of a point given in coordinates relative to the body's origin.
- Parameters
-
body Body that the given point is relative to. localPoint a point measured relative the the body's origin.
- Returns
- the same point expressed in world coordinates.
◆ GetWorldVector() [1/2]
◆ GetWorldVector() [2/2]
◆ GetLocalPoint()
◆ GetLocalVector()
◆ GetLinearVelocityFromWorldPoint()
|
related |
◆ GetLinearVelocityFromLocalPoint()
|
related |
◆ GetForce()
◆ GetTorque()
◆ GetVelocity()
Gets the velocity of the body after the given time accounting for the body's acceleration and capped by the given configuration.
- Warning
- Behavior is undefined if the given elapsed time is an invalid value (like NaN).
- Parameters
-
body Body to get the velocity for. h Time elapsed to get velocity for. Behavior is undefined if this value is invalid.
◆ GetWorldIndex()
|
related |
◆ GetFixtureCount()
|
related |
◆ RotateAboutWorldPoint()
Rotates a body a given amount around a point in world coordinates.
This changes both the linear and angular positions of the body.
- Note
- Manipulating a body's position this way may cause non-physical behavior.
- Parameters
-
body Body to rotate. amount Amount to rotate body by (in counter-clockwise direction). worldPoint Point in world coordinates.
- Examples
- Body.cpp.
◆ RotateAboutLocalPoint()
Rotates a body a given amount around a point in body local coordinates.
This changes both the linear and angular positions of the body.
- Note
- Manipulating a body's position this way may cause non-physical behavior.
-
This is a convenience function that translates the local point into world coordinates and then calls the
RotateAboutWorldPoint
function.
- Parameters
-
body Body to rotate. amount Amount to rotate body by (in counter-clockwise direction). localPoint Point in local coordinates.
- Examples
- Body.cpp.
◆ GetLocation()
Gets the body's origin location.
This is the location of the body's origin relative to its world. The location of the body after stepping the world's physics simulations is dependent on a number of factors:
◆ GetAngle()
◆ SetLocation()
Sets the body's location.
This instantly adjusts the body to be at the new location.
- Warning
- Manipulating a body's location this way can cause non-physical behavior!
- Parameters
-
body Body to move. value Valid world location of the body's local origin. Behavior is undefined if value is invalid.
- See also
- Body::SetTransform
◆ SetAngle()
Sets the body's angular orientation.
This instantly adjusts the body to be at the new angular orientation.
- Warning
- Manipulating a body's angle this way can cause non-physical behavior!
- Parameters
-
body Body to move. value Valid world angle of the body's local origin. Behavior is undefined if value is invalid.
- See also
- Body::SetTransform
- Examples
- Body.cpp.
◆ GetBodyConf()
Gets the body definition for the given body.
Definition at line 28 of file BodyConf.cpp.
Member Data Documentation
◆ InvalidIslandIndex
|
static |
The documentation for this class was generated from the following files:
- Dynamics/Body.hpp
- Collision/AABB.hpp
- Collision/MassData.hpp
- Dynamics/Body.cpp
- Dynamics/BodyConf.hpp