145#ifdef JPH_DOUBLE_PRECISION
166 Vec3 mInvInertiaDiagonal;
167 Quat mInertiaRotation;
171 Float3 mForce { 0, 0, 0 };
172 Float3 mTorque { 0, 0, 0 };
174 float mLinearDamping;
175 float mAngularDamping;
176 float mMaxLinearVelocity;
177 float mMaxAngularVelocity;
178 float mGravityFactor;
179 uint32 mIndexInActiveBodies;
188#ifdef JPH_DOUBLE_PRECISION
191 Sphere mSleepTestSpheres[3];
192 float mSleepTestTimer;
194#ifdef JPH_ENABLE_ASSERTS
uint32_t uint32
Definition Core.h:312
#define JPH_NAMESPACE_END
Definition Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition Core.h:234
#define JPH_DET_LOG(...)
By default we log nothing.
Definition DeterminismLog.h:155
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:29
EMotionQuality
Motion quality, or how well it detects collisions when it has a high velocity.
Definition MotionQuality.h:11
EMotionType
Motion type of a physics body.
Definition MotionType.h:11
@ Dynamic
Responds to forces as a normal physics object.
Class that contains all bodies.
Definition BodyManager.h:30
static JPH_INLINE DVec3 sLoadDouble3Unsafe(const Double3 &inV)
Load 3 doubles from memory (reads 64 bits extra which it doesn't use)
Definition DVec3.inl:155
Class that holds 3 doubles. Used as a storage class. Convert to DVec3 for calculations.
Definition Double3.h:13
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition Float3.h:13
Describes the mass and inertia properties of a body. Used during body construction only.
Definition MassProperties.h:16
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
The Body class only keeps track of state for static bodies, the MotionProperties class keeps the addi...
Definition MotionProperties.h:20
void SetLinearVelocity(Vec3Arg inLinearVelocity)
Set world space linear velocity of the center of mass.
Definition MotionProperties.h:31
uint32 GetIslandIndexInternal() const
Access to the island index.
Definition MotionProperties.h:139
void ClampAngularVelocity()
Definition MotionProperties.inl:58
void RestoreState(StateRecorder &inStream)
Restoring state for replay.
Definition MotionProperties.cpp:33
void SetAngularVelocityClamped(Vec3Arg inAngularVelocity)
Set world space angular velocity of the center of mass, will make sure the value is clamped against t...
Definition MotionProperties.h:43
void ClampLinearVelocity()
Clamp velocity according to limit.
Definition MotionProperties.inl:48
Quat GetInertiaRotation() const
Rotation (R) that takes inverse inertia diagonal to local space: .
Definition MotionProperties.h:92
float GetMaxLinearVelocity() const
Maximum linear velocity that a body can achieve. Used to prevent the system from exploding.
Definition MotionProperties.h:52
JPH_INLINE 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 (uni...
Definition MotionProperties.h:112
void SaveState(StateRecorder &inStream) const
Saving state for replay.
Definition MotionProperties.cpp:12
Vec3 GetInverseInertiaDiagonal() const
Diagonal of inverse inertia matrix: D. Should only be called on a dynamic object (static or kinematic...
Definition MotionProperties.h:89
void SetInverseInertia(Vec3Arg inDiagonal, QuatArg inRot)
Definition MotionProperties.h:97
float GetGravityFactor() const
Get gravity factor (1 = normal gravity, 0 = no gravity)
Definition MotionProperties.h:73
void AddLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition MotionProperties.h:126
float GetMaxAngularVelocity() const
Maximum angular velocity that a body can achieve. Used to prevent the system from exploding.
Definition MotionProperties.h:56
void SetLinearVelocityClamped(Vec3Arg inLinearVelocity)
Set world space linear velocity of the center of mass, will make sure the value is clamped against th...
Definition MotionProperties.h:34
float GetInverseMassUnchecked() const
Definition MotionProperties.h:81
Vec3 GetLinearVelocity() const
Get world space linear velocity of the center of mass.
Definition MotionProperties.h:28
Vec3 GetAngularVelocity() const
Get world space angular velocity of the center of mass.
Definition MotionProperties.h:37
void SetMaxAngularVelocity(float inAngularVelocity)
Definition MotionProperties.h:57
JPH_INLINE Vec3 GetAccumulatedTorque() const
Definition MotionProperties.h:118
void SetIslandIndexInternal(uint32 inIndex)
Definition MotionProperties.h:140
float GetAngularDamping() const
Get angular damping: dw/dt = -c * w. c must be between 0 and 1 but is usually close to 0.
Definition MotionProperties.h:69
void SubLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition MotionProperties.h:127
float GetInverseMass() const
Get inverse mass (1 / mass). Should only be called on a dynamic object (static or kinematic bodies ha...
Definition MotionProperties.h:80
void SetGravityFactor(float inGravityFactor)
Definition MotionProperties.h:74
uint32 GetIndexInActiveBodiesInternal() const
Access to the index in the active bodies array.
Definition MotionProperties.h:143
float GetLinearDamping() const
Get linear damping: dv/dt = -c * v. c must be between 0 and 1 but is usually close to 0.
Definition MotionProperties.h:65
void SubAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition MotionProperties.h:129
Mat44 GetLocalSpaceInverseInertiaUnchecked() const
Same as GetLocalSpaceInverseInertia() but doesn't check if the body is dynamic.
Definition MotionProperties.inl:68
void SetInverseMass(float inInverseMass)
Definition MotionProperties.h:86
void SetAngularVelocity(Vec3Arg inAngularVelocity)
Set world space angular velocity of the center of mass.
Definition MotionProperties.h:40
JPH_INLINE Vec3 MultiplyWorldSpaceInverseInertiaByVector(QuatArg inBodyRotation, Vec3Arg inV) const
Multiply a vector with the inverse world space inertia tensor ( ). Zero if object is static or kinema...
Definition MotionProperties.inl:90
void ResetSleepTestSpheres(const RVec3 *inPoints)
Reset spheres to center around inPoints with radius 0.
Definition MotionProperties.inl:121
JPH_INLINE Vec3 GetAccumulatedForce() const
Definition MotionProperties.h:115
void MoveKinematic(Vec3Arg inDeltaPosition, QuatArg inDeltaRotation, float inDeltaTime)
Set velocity of body such that it will be rotate/translate by inDeltaPosition/Rotation in inDeltaTime...
Definition MotionProperties.inl:32
Mat44 GetInverseInertiaForRotation(Mat44Arg inRotation) const
Get inverse inertia matrix ( ) for a given object rotation (translation will be ignored)....
Definition MotionProperties.inl:81
void SetMaxLinearVelocity(float inLinearVelocity)
Definition MotionProperties.h:53
JPH_OVERRIDE_NEW_DELETE EMotionQuality GetMotionQuality() const
Motion quality, or how well it detects collisions when it has a high velocity.
Definition MotionProperties.h:25
void SetLinearDamping(float inLinearDamping)
Definition MotionProperties.h:66
Mat44 GetLocalSpaceInverseInertia() const
Get inverse inertia matrix ( ). Will be a matrix of zeros for a static or kinematic object.
Definition MotionProperties.inl:75
void ResetForceAndTorqueInternal()
At the end of a simulation update the forces and torques need to be reset for the next frame.
Definition MotionProperties.h:136
void SetAngularDamping(float inAngularDamping)
Definition MotionProperties.h:70
void ApplyForceTorqueAndDragInternal(QuatArg inBodyRotation, Vec3Arg inGravity, float inDeltaTime)
Apply all accumulated forces, torques and drag (should only be called by the PhysicsSystem)
Definition MotionProperties.inl:98
void SetMassProperties(const MassProperties &inMassProperties)
Set the mass and inertia tensor.
Definition MotionProperties.inl:9
void AddAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition MotionProperties.h:128
Definition StateRecorder.h:15
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition Vec3.inl:582
JPH_INLINE float Length() const
Length of vector.
Definition Vec3.inl:669
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107
JPH_INLINE bool IsNaN() const
Test if vector contains NaN elements.
Definition Vec3.inl:742
static JPH_INLINE Vec3 sLoadFloat3Unsafe(const Float3 &inV)
Load 3 floats from memory (reads 32 bits extra which it doesn't use)
Definition Vec3.inl:134