Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
BodyWithMotionProperties Class Reference
Inheritance diagram for BodyWithMotionProperties:
Body NonCopyable

Public Attributes

JPH_OVERRIDE_NEW_DELETE MotionProperties mMotionProperties
 

Additional Inherited Members

- Public Member Functions inherited from Body
JPH_OVERRIDE_NEW_DELETE const BodyIDGetID () const
 Get the id of this body.
 
EBodyType GetBodyType () const
 Get the type of body (rigid or soft)
 
bool IsRigidBody () const
 Check if this body is a rigid body.
 
bool IsSoftBody () const
 Check if this body is a soft body.
 
JPH_TSAN_NO_SANITIZE bool IsActive () const
 If this body is currently actively simulating (true) or sleeping (false)
 
bool IsStatic () const
 Check if this body is static (not movable)
 
bool IsKinematic () const
 Check if this body is kinematic (keyframed), which means that it will move according to its current velocity, but forces don't affect it.
 
bool IsDynamic () const
 Check if this body is dynamic, which means that it moves and forces can act on it.
 
bool CanBeKinematicOrDynamic () const
 Check if a body could be made kinematic or dynamic (if it was created dynamic or with mAllowDynamicOrKinematic set to true)
 
void SetIsSensor (bool inIsSensor)
 
bool IsSensor () const
 Check if this body is a sensor.
 
void SetCollideKinematicVsNonDynamic (bool inCollide)
 
bool GetCollideKinematicVsNonDynamic () const
 Check if kinematic objects can generate contact points against other kinematic or static objects.
 
void SetUseManifoldReduction (bool inUseReduction)
 
bool GetUseManifoldReduction () const
 Check if this body can use manifold reduction.
 
bool GetUseManifoldReductionWithBody (const Body &inBody2) const
 Checks if the combination of this body and inBody2 should use manifold reduction.
 
void SetApplyGyroscopicForce (bool inApply)
 Set to indicate that the gyroscopic force should be applied to this body (aka Dzhanibekov effect, see https://en.wikipedia.org/wiki/Tennis_racket_theorem)
 
bool GetApplyGyroscopicForce () const
 Check if the gyroscopic force is being applied for this body.
 
void SetEnhancedInternalEdgeRemoval (bool inApply)
 Set to indicate that extra effort should be made to try to remove ghost contacts (collisions with internal edges of a mesh). This is more expensive but makes bodies move smoother over a mesh with convex edges.
 
bool GetEnhancedInternalEdgeRemoval () const
 Check if enhanced internal edge removal is turned on.
 
bool GetEnhancedInternalEdgeRemovalWithBody (const Body &inBody2) const
 Checks if the combination of this body and inBody2 should use enhanced internal edge removal.
 
EMotionType GetMotionType () const
 Get the bodies motion type.
 
void SetMotionType (EMotionType inMotionType)
 Set the motion type of this body. Consider using BodyInterface::SetMotionType instead of this function if the body may be active or if it needs to be activated.
 
BroadPhaseLayer GetBroadPhaseLayer () const
 Get broadphase layer, this determines in which broad phase sub-tree the object is placed.
 
ObjectLayer GetObjectLayer () const
 Get object layer, this determines which other objects it collides with.
 
const CollisionGroupGetCollisionGroup () const
 Collision group and sub-group ID, determines which other objects it collides with.
 
CollisionGroupGetCollisionGroup ()
 
void SetCollisionGroup (const CollisionGroup &inGroup)
 
bool GetAllowSleeping () const
 If this body can go to sleep. Note that disabling sleeping on a sleeping object will not wake it up.
 
void SetAllowSleeping (bool inAllow)
 
void ResetSleepTimer ()
 Resets the sleep timer. This does not wake up the body if it is sleeping, but allows resetting the system that detects when a body is sleeping.
 
float GetFriction () const
 Friction (dimensionless number, usually between 0 and 1, 0 = no friction, 1 = friction force equals force that presses the two bodies together). Note that bodies can have negative friction but the combined friction (see PhysicsSystem::SetCombineFriction) should never go below zero.
 
void SetFriction (float inFriction)
 
float GetRestitution () const
 Restitution (dimensionless number, usually between 0 and 1, 0 = completely inelastic collision response, 1 = completely elastic collision response). Note that bodies can have negative restitution but the combined restitution (see PhysicsSystem::SetCombineRestitution) should never go below zero.
 
void SetRestitution (float inRestitution)
 
Vec3 GetLinearVelocity () const
 Get world space linear velocity of the center of mass (unit: m/s)
 
void SetLinearVelocity (Vec3Arg inLinearVelocity)
 
void SetLinearVelocityClamped (Vec3Arg inLinearVelocity)
 
Vec3 GetAngularVelocity () const
 Get world space angular velocity of the center of mass (unit: rad/s)
 
void SetAngularVelocity (Vec3Arg inAngularVelocity)
 
void SetAngularVelocityClamped (Vec3Arg inAngularVelocity)
 
Vec3 GetPointVelocityCOM (Vec3Arg inPointRelativeToCOM) const
 Velocity of point inPoint (in center of mass space, e.g. on the surface of the body) of the body (unit: m/s)
 
Vec3 GetPointVelocity (RVec3Arg inPoint) const
 Velocity of point inPoint (in world space, e.g. on the surface of the body) of the body (unit: m/s)
 
void AddForce (Vec3Arg inForce)
 
void AddForce (Vec3Arg inForce, RVec3Arg inPosition)
 
void AddTorque (Vec3Arg inTorque)
 
Vec3 GetAccumulatedForce () const
 
Vec3 GetAccumulatedTorque () const
 
JPH_INLINE void ResetForce ()
 
JPH_INLINE void ResetTorque ()
 
JPH_INLINE void ResetMotion ()
 
Mat44 GetInverseInertia () const
 Get inverse inertia tensor in world space.
 
void AddImpulse (Vec3Arg inImpulse)
 
void AddImpulse (Vec3Arg inImpulse, RVec3Arg inPosition)
 
void AddAngularImpulse (Vec3Arg inAngularImpulse)
 
void MoveKinematic (RVec3Arg inTargetPosition, QuatArg inTargetRotation, float inDeltaTime)
 
void GetSubmergedVolume (RVec3Arg inSurfacePosition, Vec3Arg inSurfaceNormal, float &outTotalVolume, float &outSubmergedVolume, Vec3 &outRelativeCenterOfBuoyancy) const
 
bool ApplyBuoyancyImpulse (RVec3Arg inSurfacePosition, Vec3Arg inSurfaceNormal, float inBuoyancy, float inLinearDrag, float inAngularDrag, Vec3Arg inFluidVelocity, Vec3Arg inGravity, float inDeltaTime)
 
bool ApplyBuoyancyImpulse (float inTotalVolume, float inSubmergedVolume, Vec3Arg inRelativeCenterOfBuoyancy, float inBuoyancy, float inLinearDrag, float inAngularDrag, Vec3Arg inFluidVelocity, Vec3Arg inGravity, float inDeltaTime)
 
bool IsInBroadPhase () const
 Check if this body has been added to the physics system.
 
bool IsCollisionCacheInvalid () const
 Check if this body has been changed in such a way that the collision cache should be considered invalid for any body interacting with this body.
 
const ShapeGetShape () const
 Get the shape of this body.
 
RVec3 GetPosition () const
 World space position of the body.
 
Quat GetRotation () const
 World space rotation of the body.
 
RMat44 GetWorldTransform () const
 Calculates the transform of this body.
 
RVec3 GetCenterOfMassPosition () const
 Gets the world space position of this body's center of mass.
 
RMat44 GetCenterOfMassTransform () const
 Calculates the transform for this body's center of mass.
 
RMat44 GetInverseCenterOfMassTransform () const
 Calculates the inverse of the transform for this body's center of mass.
 
const AABoxGetWorldSpaceBounds () const
 Get world space bounding box.
 
const MotionPropertiesGetMotionProperties () const
 Access to the motion properties.
 
MotionPropertiesGetMotionProperties ()
 
const MotionPropertiesGetMotionPropertiesUnchecked () const
 Access to the motion properties (version that does not check if the object is kinematic or dynamic)
 
MotionPropertiesGetMotionPropertiesUnchecked ()
 
uint64 GetUserData () const
 Access to the user data, can be used for anything by the application.
 
void SetUserData (uint64 inUserData)
 
Vec3 GetWorldSpaceSurfaceNormal (const SubShapeID &inSubShapeID, RVec3Arg inPosition) const
 Get surface normal of a particular sub shape and its world space surface position on this body.
 
TransformedShape GetTransformedShape () const
 Get the transformed shape of this body, which can be used to do collision detection outside of a body lock.
 
BodyCreationSettings GetBodyCreationSettings () const
 Debug function to convert a body back to a body creation settings object to be able to save/recreate the body later.
 
SoftBodyCreationSettings GetSoftBodyCreationSettings () const
 Debug function to convert a soft body back to a soft body creation settings object to be able to save/recreate the body later.
 
void AddPositionStep (Vec3Arg inLinearVelocityTimesDeltaTime)
 Update position using an Euler step (used during position integrate & constraint solving)
 
void SubPositionStep (Vec3Arg inLinearVelocityTimesDeltaTime)
 
void AddRotationStep (Vec3Arg inAngularVelocityTimesDeltaTime)
 Update rotation using an Euler step (used during position integrate & constraint solving)
 
void SubRotationStep (Vec3Arg inAngularVelocityTimesDeltaTime)
 
void SetInBroadPhaseInternal (bool inInBroadPhase)
 Flag if body is in the broadphase (should only be called by the BroadPhase)
 
bool InvalidateContactCacheInternal ()
 Invalidate the contact cache (should only be called by the BodyManager), will be reset the next simulation step. Returns true if the contact cache was still valid.
 
void ValidateContactCacheInternal ()
 Reset the collision cache invalid flag (should only be called by the BodyManager).
 
void CalculateWorldSpaceBoundsInternal ()
 Updates world space bounding box (should only be called by the PhysicsSystem)
 
void SetPositionAndRotationInternal (RVec3Arg inPosition, QuatArg inRotation, bool inResetSleepTimer=true)
 Function to update body's position (should only be called by the BodyInterface since it also requires updating the broadphase)
 
void UpdateCenterOfMassInternal (Vec3Arg inPreviousCenterOfMass, bool inUpdateMassProperties)
 
void SetShapeInternal (const Shape *inShape, bool inUpdateMassProperties)
 
JPH_TSAN_NO_SANITIZE uint32 GetIndexInActiveBodiesInternal () const
 Access to the index in the BodyManager::mActiveBodies list.
 
ECanSleep UpdateSleepStateInternal (float inDeltaTime, float inMaxMovement, float inTimeBeforeSleep)
 Update eligibility for sleeping.
 
void SaveState (StateRecorder &inStream) const
 Saving state for replay.
 
void RestoreState (StateRecorder &inStream)
 Restoring state for replay.
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 
- Static Public Member Functions inherited from Body
static bool sFindCollidingPairsCanCollide (const Body &inBody1, const Body &inBody2)
 
- Static Public Attributes inherited from Body
static Body sFixedToWorld
 A dummy body that can be used by constraints to attach a constraint to the world instead of another body.
 
static constexpr uint32 cInactiveIndex = MotionProperties::cInactiveIndex
 Constant indicating that body is not active.
 

Member Data Documentation

◆ mMotionProperties

JPH_OVERRIDE_NEW_DELETE MotionProperties BodyWithMotionProperties::mMotionProperties

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