Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
BodyInterface Class Reference

#include <BodyInterface.h>

Inheritance diagram for BodyInterface:
NonCopyable

Public Types

using AddState = void *
 Broadphase add state handle, used to keep track of a batch while adding to the broadphase. More...
 

Public Member Functions

void Init (BodyLockInterface &inBodyLockInterface, BodyManager &inBodyManager, BroadPhase &inBroadPhase)
 Initialize the interface (should only be called by PhysicsSystem) More...
 
BodyCreateBody (const BodyCreationSettings &inSettings)
 
BodyCreateSoftBody (const SoftBodyCreationSettings &inSettings)
 
BodyCreateBodyWithID (const BodyID &inBodyID, const BodyCreationSettings &inSettings)
 
BodyCreateSoftBodyWithID (const BodyID &inBodyID, const SoftBodyCreationSettings &inSettings)
 Create a soft body with specified ID. See comments at CreateBodyWithID. More...
 
BodyCreateBodyWithoutID (const BodyCreationSettings &inSettings) const
 
BodyCreateSoftBodyWithoutID (const SoftBodyCreationSettings &inSettings) const
 Advanced use only. Creates a body without specifying an ID. See comments at CreateBodyWithoutID. More...
 
void DestroyBodyWithoutID (Body *inBody) const
 
bool AssignBodyID (Body *ioBody)
 
bool AssignBodyID (Body *ioBody, const BodyID &inBodyID)
 
BodyUnassignBodyID (const BodyID &inBodyID)
 Advanced use only. See UnassignBodyIDs. Unassigns the ID of a single body. More...
 
void UnassignBodyIDs (const BodyID *inBodyIDs, int inNumber, Body **outBodies)
 
void DestroyBody (const BodyID &inBodyID)
 Destroy a body. More...
 
void DestroyBodies (const BodyID *inBodyIDs, int inNumber)
 Destroy multiple bodies. More...
 
void AddBody (const BodyID &inBodyID, EActivation inActivationMode)
 
void RemoveBody (const BodyID &inBodyID)
 Remove body from the physics system. More...
 
bool IsAdded (const BodyID &inBodyID) const
 Check if a body has been added to the physics system. More...
 
BodyID CreateAndAddBody (const BodyCreationSettings &inSettings, EActivation inActivationMode)
 
BodyID CreateAndAddSoftBody (const SoftBodyCreationSettings &inSettings, EActivation inActivationMode)
 
TwoBodyConstraintCreateConstraint (const TwoBodyConstraintSettings *inSettings, const BodyID &inBodyID1, const BodyID &inBodyID2)
 Create a two body constraint. More...
 
void ActivateConstraint (const TwoBodyConstraint *inConstraint)
 Activate non-static bodies attached to a constraint. More...
 
void MoveKinematic (const BodyID &inBodyID, RVec3Arg inTargetPosition, QuatArg inTargetRotation, float inDeltaTime)
 Set velocity of body such that it will be positioned at inTargetPosition/Rotation in inDeltaTime seconds (will activate body if needed) More...
 
void SetLinearAndAngularVelocity (const BodyID &inBodyID, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity)
 
void GetLinearAndAngularVelocity (const BodyID &inBodyID, Vec3 &outLinearVelocity, Vec3 &outAngularVelocity) const
 
void SetLinearVelocity (const BodyID &inBodyID, Vec3Arg inLinearVelocity)
 
Vec3 GetLinearVelocity (const BodyID &inBodyID) const
 
void AddLinearVelocity (const BodyID &inBodyID, Vec3Arg inLinearVelocity)
 Add velocity to current velocity. More...
 
void AddLinearAndAngularVelocity (const BodyID &inBodyID, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity)
 Add linear and angular to current velocities. More...
 
void SetAngularVelocity (const BodyID &inBodyID, Vec3Arg inAngularVelocity)
 
Vec3 GetAngularVelocity (const BodyID &inBodyID) const
 
Vec3 GetPointVelocity (const BodyID &inBodyID, RVec3Arg inPoint) const
 Velocity of point inPoint (in world space, e.g. on the surface of the body) of the body. More...
 
void SetPositionRotationAndVelocity (const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity)
 
Mat44 GetInverseInertia (const BodyID &inBodyID) const
 Get inverse inertia tensor in world space. More...
 
TransformedShape GetTransformedShape (const BodyID &inBodyID) const
 Get transform and shape for this body, used to perform collision detection. More...
 
uint64 GetUserData (const BodyID &inBodyID) const
 Get the user data for a body. More...
 
void SetUserData (const BodyID &inBodyID, uint64 inUserData) const
 
const PhysicsMaterialGetMaterial (const BodyID &inBodyID, const SubShapeID &inSubShapeID) const
 Get the material for a particular sub shape. More...
 
void InvalidateContactCache (const BodyID &inBodyID)
 Set the Body::EFlags::InvalidateContactCache flag for the specified body. This means that the collision cache is invalid for any body pair involving that body until the next physics step. More...
 
Batch adding interface, see Broadphase for further documentation.

Note that ioBodies array must be kept constant while the add is in progress.

AddState AddBodiesPrepare (BodyID *ioBodies, int inNumber)
 
void AddBodiesFinalize (BodyID *ioBodies, int inNumber, AddState inAddState, EActivation inActivationMode)
 
void AddBodiesAbort (BodyID *ioBodies, int inNumber, AddState inAddState)
 
void RemoveBodies (BodyID *ioBodies, int inNumber)
 
Activate / deactivate a body
void ActivateBody (const BodyID &inBodyID)
 
void ActivateBodies (const BodyID *inBodyIDs, int inNumber)
 
void ActivateBodiesInAABox (const AABox &inBox, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter)
 
void DeactivateBody (const BodyID &inBodyID)
 
void DeactivateBodies (const BodyID *inBodyIDs, int inNumber)
 
bool IsActive (const BodyID &inBodyID) const
 
Access to the shape of a body
RefConst< ShapeGetShape (const BodyID &inBodyID) const
 Get the current shape. More...
 
void SetShape (const BodyID &inBodyID, const Shape *inShape, bool inUpdateMassProperties, EActivation inActivationMode) const
 
void NotifyShapeChanged (const BodyID &inBodyID, Vec3Arg inPreviousCenterOfMass, bool inUpdateMassProperties, EActivation inActivationMode) const
 
Object layer of a body
void SetObjectLayer (const BodyID &inBodyID, ObjectLayer inLayer)
 
ObjectLayer GetObjectLayer (const BodyID &inBodyID) const
 
Position and rotation of a body
void SetPositionAndRotation (const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode)
 
void SetPositionAndRotationWhenChanged (const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode)
 Will only update the position/rotation and activate the body when the difference is larger than a very small number. This avoids updating the broadphase/waking up a body when the resulting position/orientation doesn't really change. More...
 
void GetPositionAndRotation (const BodyID &inBodyID, RVec3 &outPosition, Quat &outRotation) const
 
void SetPosition (const BodyID &inBodyID, RVec3Arg inPosition, EActivation inActivationMode)
 
RVec3 GetPosition (const BodyID &inBodyID) const
 
RVec3 GetCenterOfMassPosition (const BodyID &inBodyID) const
 
void SetRotation (const BodyID &inBodyID, QuatArg inRotation, EActivation inActivationMode)
 
Quat GetRotation (const BodyID &inBodyID) const
 
RMat44 GetWorldTransform (const BodyID &inBodyID) const
 
RMat44 GetCenterOfMassTransform (const BodyID &inBodyID) const
 
Add forces to the body
void AddForce (const BodyID &inBodyID, Vec3Arg inForce)
 See Body::AddForce. More...
 
void AddForce (const BodyID &inBodyID, Vec3Arg inForce, RVec3Arg inPoint)
 Applied at inPoint. More...
 
void AddTorque (const BodyID &inBodyID, Vec3Arg inTorque)
 See Body::AddTorque. More...
 
void AddForceAndTorque (const BodyID &inBodyID, Vec3Arg inForce, Vec3Arg inTorque)
 A combination of Body::AddForce and Body::AddTorque. More...
 
Add an impulse to the body
void AddImpulse (const BodyID &inBodyID, Vec3Arg inImpulse)
 Applied at center of mass. More...
 
void AddImpulse (const BodyID &inBodyID, Vec3Arg inImpulse, RVec3Arg inPoint)
 Applied at inPoint. More...
 
void AddAngularImpulse (const BodyID &inBodyID, Vec3Arg inAngularImpulse)
 
Body type
EBodyType GetBodyType (const BodyID &inBodyID) const
 
Body motion type
void SetMotionType (const BodyID &inBodyID, EMotionType inMotionType, EActivation inActivationMode)
 
EMotionType GetMotionType (const BodyID &inBodyID) const
 
Body motion quality
void SetMotionQuality (const BodyID &inBodyID, EMotionQuality inMotionQuality)
 
EMotionQuality GetMotionQuality (const BodyID &inBodyID) const
 
Restitution
void SetRestitution (const BodyID &inBodyID, float inRestitution)
 
float GetRestitution (const BodyID &inBodyID) const
 
Friction
void SetFriction (const BodyID &inBodyID, float inFriction)
 
float GetFriction (const BodyID &inBodyID) const
 
Gravity factor
void SetGravityFactor (const BodyID &inBodyID, float inGravityFactor)
 
float GetGravityFactor (const BodyID &inBodyID) const
 
Manifold reduction
void SetUseManifoldReduction (const BodyID &inBodyID, bool inUseReduction)
 
bool GetUseManifoldReduction (const BodyID &inBodyID) const
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Detailed Description

Class that provides operations on bodies using a body ID. Note that if you need to do multiple operations on a single body, it is more efficient to lock the body once and combine the operations. All quantities are in world space unless otherwise specified.

Member Typedef Documentation

◆ AddState

using BodyInterface::AddState = void *

Broadphase add state handle, used to keep track of a batch while adding to the broadphase.

Member Function Documentation

◆ ActivateBodies()

void BodyInterface::ActivateBodies ( const BodyID inBodyIDs,
int  inNumber 
)

◆ ActivateBodiesInAABox()

void BodyInterface::ActivateBodiesInAABox ( const AABox inBox,
const BroadPhaseLayerFilter inBroadPhaseLayerFilter,
const ObjectLayerFilter inObjectLayerFilter 
)

◆ ActivateBody()

void BodyInterface::ActivateBody ( const BodyID inBodyID)

◆ ActivateConstraint()

void BodyInterface::ActivateConstraint ( const TwoBodyConstraint inConstraint)

Activate non-static bodies attached to a constraint.

◆ AddAngularImpulse()

void BodyInterface::AddAngularImpulse ( const BodyID inBodyID,
Vec3Arg  inAngularImpulse 
)

◆ AddBodiesAbort()

void BodyInterface::AddBodiesAbort ( BodyID ioBodies,
int  inNumber,
AddState  inAddState 
)

◆ AddBodiesFinalize()

void BodyInterface::AddBodiesFinalize ( BodyID ioBodies,
int  inNumber,
AddState  inAddState,
EActivation  inActivationMode 
)

◆ AddBodiesPrepare()

BodyInterface::AddState BodyInterface::AddBodiesPrepare ( BodyID ioBodies,
int  inNumber 
)

◆ AddBody()

void BodyInterface::AddBody ( const BodyID inBodyID,
EActivation  inActivationMode 
)

Add body to the physics system. Note that if you need to add multiple bodies, use the AddBodiesPrepare/AddBodiesFinalize function. Adding many bodies, one at a time, results in a really inefficient broadphase until PhysicsSystem::OptimizeBroadPhase is called or when PhysicsSystem::Update rebuilds the tree! After adding, to get a body by ID use the BodyLockRead or BodyLockWrite interface!

◆ AddForce() [1/2]

void BodyInterface::AddForce ( const BodyID inBodyID,
Vec3Arg  inForce 
)

◆ AddForce() [2/2]

void BodyInterface::AddForce ( const BodyID inBodyID,
Vec3Arg  inForce,
RVec3Arg  inPoint 
)

Applied at inPoint.

◆ AddForceAndTorque()

void BodyInterface::AddForceAndTorque ( const BodyID inBodyID,
Vec3Arg  inForce,
Vec3Arg  inTorque 
)

A combination of Body::AddForce and Body::AddTorque.

◆ AddImpulse() [1/2]

void BodyInterface::AddImpulse ( const BodyID inBodyID,
Vec3Arg  inImpulse 
)

Applied at center of mass.

◆ AddImpulse() [2/2]

void BodyInterface::AddImpulse ( const BodyID inBodyID,
Vec3Arg  inImpulse,
RVec3Arg  inPoint 
)

Applied at inPoint.

◆ AddLinearAndAngularVelocity()

void BodyInterface::AddLinearAndAngularVelocity ( const BodyID inBodyID,
Vec3Arg  inLinearVelocity,
Vec3Arg  inAngularVelocity 
)

Add linear and angular to current velocities.

◆ AddLinearVelocity()

void BodyInterface::AddLinearVelocity ( const BodyID inBodyID,
Vec3Arg  inLinearVelocity 
)

Add velocity to current velocity.

◆ AddTorque()

void BodyInterface::AddTorque ( const BodyID inBodyID,
Vec3Arg  inTorque 
)

◆ AssignBodyID() [1/2]

bool BodyInterface::AssignBodyID ( Body ioBody)

Advanced use only. Assigns the next available body ID to a body that was created using CreateBodyWithoutID. After this call, the body can be added to the physics system.

Returns
false if the body already has an ID or out of body ids.

◆ AssignBodyID() [2/2]

bool BodyInterface::AssignBodyID ( Body ioBody,
const BodyID inBodyID 
)

Advanced use only. Assigns a body ID to a body that was created using CreateBodyWithoutID. After this call, the body can be added to the physics system.

Returns
false if the body already has an ID or if the ID is not valid.

◆ CreateAndAddBody()

BodyID BodyInterface::CreateAndAddBody ( const BodyCreationSettings inSettings,
EActivation  inActivationMode 
)

Combines CreateBody and AddBody

Returns
Created body ID or an invalid ID when out of bodies

◆ CreateAndAddSoftBody()

BodyID BodyInterface::CreateAndAddSoftBody ( const SoftBodyCreationSettings inSettings,
EActivation  inActivationMode 
)

Combines CreateSoftBody and AddBody

Returns
Created body ID or an invalid ID when out of bodies

◆ CreateBody()

JPH_NAMESPACE_BEGIN Body * BodyInterface::CreateBody ( const BodyCreationSettings inSettings)

Create a rigid body

Returns
Created body or null when out of bodies

◆ CreateBodyWithID()

Body * BodyInterface::CreateBodyWithID ( const BodyID inBodyID,
const BodyCreationSettings inSettings 
)

Create a rigid body with specified ID. This function can be used if a simulation is to run in sync between clients or if a simulation needs to be restored exactly. The ID created on the server can be replicated to the client and used to create a deterministic simulation.

Returns
Created body or null when the body ID is invalid or a body of the same ID already exists.

◆ CreateBodyWithoutID()

Body * BodyInterface::CreateBodyWithoutID ( const BodyCreationSettings inSettings) const

Advanced use only. Creates a rigid body without specifying an ID. This body cannot be added to the physics system until it has been assigned a body ID. This can be used to decouple allocation from registering the body. A call to CreateBodyWithoutID followed by AssignBodyID is equivalent to calling CreateBodyWithID.

Returns
Created body

◆ CreateConstraint()

TwoBodyConstraint * BodyInterface::CreateConstraint ( const TwoBodyConstraintSettings inSettings,
const BodyID inBodyID1,
const BodyID inBodyID2 
)

Create a two body constraint.

◆ CreateSoftBody()

Body * BodyInterface::CreateSoftBody ( const SoftBodyCreationSettings inSettings)

Create a soft body

Returns
Created body or null when out of bodies

◆ CreateSoftBodyWithID()

Body * BodyInterface::CreateSoftBodyWithID ( const BodyID inBodyID,
const SoftBodyCreationSettings inSettings 
)

Create a soft body with specified ID. See comments at CreateBodyWithID.

◆ CreateSoftBodyWithoutID()

Body * BodyInterface::CreateSoftBodyWithoutID ( const SoftBodyCreationSettings inSettings) const

Advanced use only. Creates a body without specifying an ID. See comments at CreateBodyWithoutID.

◆ DeactivateBodies()

void BodyInterface::DeactivateBodies ( const BodyID inBodyIDs,
int  inNumber 
)

◆ DeactivateBody()

void BodyInterface::DeactivateBody ( const BodyID inBodyID)

◆ DestroyBodies()

void BodyInterface::DestroyBodies ( const BodyID inBodyIDs,
int  inNumber 
)

Destroy multiple bodies.

◆ DestroyBody()

void BodyInterface::DestroyBody ( const BodyID inBodyID)

Destroy a body.

◆ DestroyBodyWithoutID()

void BodyInterface::DestroyBodyWithoutID ( Body inBody) const

Advanced use only. Destroy a body previously created with CreateBodyWithoutID that hasn't gotten an ID yet through the AssignBodyID function, or a body that has had its body ID unassigned through UnassignBodyIDs. Bodies that have an ID should be destroyed through DestroyBody.

◆ GetAngularVelocity()

Vec3 BodyInterface::GetAngularVelocity ( const BodyID inBodyID) const

◆ GetBodyType()

EBodyType BodyInterface::GetBodyType ( const BodyID inBodyID) const

◆ GetCenterOfMassPosition()

RVec3 BodyInterface::GetCenterOfMassPosition ( const BodyID inBodyID) const

◆ GetCenterOfMassTransform()

RMat44 BodyInterface::GetCenterOfMassTransform ( const BodyID inBodyID) const

◆ GetFriction()

float BodyInterface::GetFriction ( const BodyID inBodyID) const

◆ GetGravityFactor()

float BodyInterface::GetGravityFactor ( const BodyID inBodyID) const

◆ GetInverseInertia()

Mat44 BodyInterface::GetInverseInertia ( const BodyID inBodyID) const

Get inverse inertia tensor in world space.

◆ GetLinearAndAngularVelocity()

void BodyInterface::GetLinearAndAngularVelocity ( const BodyID inBodyID,
Vec3 outLinearVelocity,
Vec3 outAngularVelocity 
) const

◆ GetLinearVelocity()

Vec3 BodyInterface::GetLinearVelocity ( const BodyID inBodyID) const

◆ GetMaterial()

const PhysicsMaterial * BodyInterface::GetMaterial ( const BodyID inBodyID,
const SubShapeID inSubShapeID 
) const

Get the material for a particular sub shape.

◆ GetMotionQuality()

EMotionQuality BodyInterface::GetMotionQuality ( const BodyID inBodyID) const

◆ GetMotionType()

EMotionType BodyInterface::GetMotionType ( const BodyID inBodyID) const

◆ GetObjectLayer()

ObjectLayer BodyInterface::GetObjectLayer ( const BodyID inBodyID) const

◆ GetPointVelocity()

Vec3 BodyInterface::GetPointVelocity ( const BodyID inBodyID,
RVec3Arg  inPoint 
) const

Velocity of point inPoint (in world space, e.g. on the surface of the body) of the body.

◆ GetPosition()

RVec3 BodyInterface::GetPosition ( const BodyID inBodyID) const

◆ GetPositionAndRotation()

void BodyInterface::GetPositionAndRotation ( const BodyID inBodyID,
RVec3 outPosition,
Quat outRotation 
) const

◆ GetRestitution()

float BodyInterface::GetRestitution ( const BodyID inBodyID) const

◆ GetRotation()

Quat BodyInterface::GetRotation ( const BodyID inBodyID) const

◆ GetShape()

RefConst< Shape > BodyInterface::GetShape ( const BodyID inBodyID) const

Get the current shape.

◆ GetTransformedShape()

TransformedShape BodyInterface::GetTransformedShape ( const BodyID inBodyID) const

Get transform and shape for this body, used to perform collision detection.

◆ GetUseManifoldReduction()

bool BodyInterface::GetUseManifoldReduction ( const BodyID inBodyID) const

◆ GetUserData()

uint64 BodyInterface::GetUserData ( const BodyID inBodyID) const

Get the user data for a body.

◆ GetWorldTransform()

RMat44 BodyInterface::GetWorldTransform ( const BodyID inBodyID) const

◆ Init()

void BodyInterface::Init ( BodyLockInterface inBodyLockInterface,
BodyManager inBodyManager,
BroadPhase inBroadPhase 
)
inline

Initialize the interface (should only be called by PhysicsSystem)

◆ InvalidateContactCache()

void BodyInterface::InvalidateContactCache ( const BodyID inBodyID)

Set the Body::EFlags::InvalidateContactCache flag for the specified body. This means that the collision cache is invalid for any body pair involving that body until the next physics step.

◆ IsActive()

bool BodyInterface::IsActive ( const BodyID inBodyID) const

◆ IsAdded()

bool BodyInterface::IsAdded ( const BodyID inBodyID) const

Check if a body has been added to the physics system.

◆ MoveKinematic()

void BodyInterface::MoveKinematic ( const BodyID inBodyID,
RVec3Arg  inTargetPosition,
QuatArg  inTargetRotation,
float  inDeltaTime 
)

Set velocity of body such that it will be positioned at inTargetPosition/Rotation in inDeltaTime seconds (will activate body if needed)

◆ NotifyShapeChanged()

void BodyInterface::NotifyShapeChanged ( const BodyID inBodyID,
Vec3Arg  inPreviousCenterOfMass,
bool  inUpdateMassProperties,
EActivation  inActivationMode 
) const

Notify all systems to indicate that a shape has changed (usable for MutableCompoundShapes)

Parameters
inBodyIDBody ID of body that had its shape changed
inPreviousCenterOfMassCenter of mass of the shape before the alterations
inUpdateMassPropertiesWhen true, the mass and inertia tensor is recalculated
inActivationModeWeather or not to activate the body

◆ RemoveBodies()

void BodyInterface::RemoveBodies ( BodyID ioBodies,
int  inNumber 
)

◆ RemoveBody()

void BodyInterface::RemoveBody ( const BodyID inBodyID)

Remove body from the physics system.

◆ SetAngularVelocity()

void BodyInterface::SetAngularVelocity ( const BodyID inBodyID,
Vec3Arg  inAngularVelocity 
)

◆ SetFriction()

void BodyInterface::SetFriction ( const BodyID inBodyID,
float  inFriction 
)

◆ SetGravityFactor()

void BodyInterface::SetGravityFactor ( const BodyID inBodyID,
float  inGravityFactor 
)

◆ SetLinearAndAngularVelocity()

void BodyInterface::SetLinearAndAngularVelocity ( const BodyID inBodyID,
Vec3Arg  inLinearVelocity,
Vec3Arg  inAngularVelocity 
)

Linear or angular velocity (functions will activate body if needed). Note that the linear velocity is the velocity of the center of mass, which may not coincide with the position of your object, to correct for this: \(VelocityCOM = Velocity - AngularVelocity \times ShapeCOM\)

◆ SetLinearVelocity()

void BodyInterface::SetLinearVelocity ( const BodyID inBodyID,
Vec3Arg  inLinearVelocity 
)

◆ SetMotionQuality()

void BodyInterface::SetMotionQuality ( const BodyID inBodyID,
EMotionQuality  inMotionQuality 
)

◆ SetMotionType()

void BodyInterface::SetMotionType ( const BodyID inBodyID,
EMotionType  inMotionType,
EActivation  inActivationMode 
)

◆ SetObjectLayer()

void BodyInterface::SetObjectLayer ( const BodyID inBodyID,
ObjectLayer  inLayer 
)

◆ SetPosition()

void BodyInterface::SetPosition ( const BodyID inBodyID,
RVec3Arg  inPosition,
EActivation  inActivationMode 
)

◆ SetPositionAndRotation()

void BodyInterface::SetPositionAndRotation ( const BodyID inBodyID,
RVec3Arg  inPosition,
QuatArg  inRotation,
EActivation  inActivationMode 
)

◆ SetPositionAndRotationWhenChanged()

void BodyInterface::SetPositionAndRotationWhenChanged ( const BodyID inBodyID,
RVec3Arg  inPosition,
QuatArg  inRotation,
EActivation  inActivationMode 
)

Will only update the position/rotation and activate the body when the difference is larger than a very small number. This avoids updating the broadphase/waking up a body when the resulting position/orientation doesn't really change.

◆ SetPositionRotationAndVelocity()

void BodyInterface::SetPositionRotationAndVelocity ( const BodyID inBodyID,
RVec3Arg  inPosition,
QuatArg  inRotation,
Vec3Arg  inLinearVelocity,
Vec3Arg  inAngularVelocity 
)

Set the complete motion state of a body. Note that the linear velocity is the velocity of the center of mass, which may not coincide with the position of your object, to correct for this: \(VelocityCOM = Velocity - AngularVelocity \times ShapeCOM\)

◆ SetRestitution()

void BodyInterface::SetRestitution ( const BodyID inBodyID,
float  inRestitution 
)

◆ SetRotation()

void BodyInterface::SetRotation ( const BodyID inBodyID,
QuatArg  inRotation,
EActivation  inActivationMode 
)

◆ SetShape()

void BodyInterface::SetShape ( const BodyID inBodyID,
const Shape inShape,
bool  inUpdateMassProperties,
EActivation  inActivationMode 
) const

Set a new shape on the body

Parameters
inBodyIDBody ID of body that had its shape changed
inShapeThe new shape
inUpdateMassPropertiesWhen true, the mass and inertia tensor is recalculated
inActivationModeWeather or not to activate the body

◆ SetUseManifoldReduction()

void BodyInterface::SetUseManifoldReduction ( const BodyID inBodyID,
bool  inUseReduction 
)

◆ SetUserData()

void BodyInterface::SetUserData ( const BodyID inBodyID,
uint64  inUserData 
) const

◆ UnassignBodyID()

Body * BodyInterface::UnassignBodyID ( const BodyID inBodyID)

Advanced use only. See UnassignBodyIDs. Unassigns the ID of a single body.

◆ UnassignBodyIDs()

void BodyInterface::UnassignBodyIDs ( const BodyID inBodyIDs,
int  inNumber,
Body **  outBodies 
)

Advanced use only. Removes a number of body IDs from their bodies and returns the body pointers. Before calling this, the body should have been removed from the physics system. The body can be destroyed through DestroyBodyWithoutID. This can be used to decouple deallocation. A call to UnassignBodyIDs followed by calls to DestroyBodyWithoutID is equivalent to calling DestroyBodies.

Parameters
inBodyIDsA list of body IDs
inNumberNumber of bodies in the list
outBodiesIf not null on input, this will contain a list of body pointers corresponding to inBodyIDs that can be destroyed afterwards (caller assumes ownership over these).

The documentation for this class was generated from the following files: