11 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sVelocityAccess, BodyAccess::EAccess::ReadWrite));
12 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess, BodyAccess::EAccess::Read));
28 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sVelocityAccess, BodyAccess::EAccess::ReadWrite));
33 mLinearVelocity *= mMaxLinearVelocity / sqrt(
len_sq);
38 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sVelocityAccess, BodyAccess::EAccess::ReadWrite));
43 mAngularVelocity *= mMaxAngularVelocity / sqrt(
len_sq);
94 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sVelocityAccess, BodyAccess::EAccess::ReadWrite));
122 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sVelocityAccess, BodyAccess::EAccess::ReadWrite));
136 mLinearVelocity *= max(0.0f, 1.0f - mLinearDamping *
inDeltaTime);
137 mAngularVelocity *= max(0.0f, 1.0f - mAngularDamping *
inDeltaTime);
146#ifdef JPH_DOUBLE_PRECISION
151 for (
int i = 1;
i < 3; ++
i)
155 for (
int i = 0;
i < 3; ++
i)
159 mSleepTestTimer = 0.0f;
@ RigidBody
Rigid body consisting of a rigid shape.
#define JPH_NAMESPACE_END
Definition Core.h:367
#define JPH_NAMESPACE_BEGIN
Definition Core.h:361
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
constexpr T Square(T inV)
Square a value.
Definition Math.h:52
AllocateFunction Allocate
Definition Memory.cpp:59
ECanSleep
Enum that determines if an object can go to sleep.
Definition MotionProperties.h:22
@ CanSleep
Object can go to sleep.
@ CannotSleep
Object cannot go to sleep.
@ Dynamic
Responds to forces as a normal physics object.
JPH_INLINE void StoreDouble3(Double3 *outV) const
Store 3 doubles to memory.
Definition DVec3.inl:171
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
JPH_INLINE Mat44 Multiply3x3RightTransposed(Mat44Arg inM) const
Multiply 3x3 matrix by the transpose of a 3x3 matrix ( )
Definition Mat44.inl:397
JPH_INLINE Vec3 Multiply3x3(Vec3Arg inV) const
Multiply vector by only 3x3 part of the matrix.
Definition Mat44.inl:316
static JPH_INLINE Mat44 sRotation(Vec3Arg inAxis, float inAngle)
Rotate around arbitrary axis.
Definition Mat44.inl:139
void ClampAngularVelocity()
Definition MotionProperties.inl:36
ECanSleep AccumulateSleepTime(float inDeltaTime, float inTimeBeforeSleep)
Accumulate sleep time and return if a body can go to sleep.
Definition MotionProperties.inl:162
void ClampLinearVelocity()
Clamp velocity according to limit.
Definition MotionProperties.inl:26
JPH_INLINE Vec3 LockAngular(Vec3Arg inV) const
Takes an angular velocity / torque vector inV and returns a vector where the components that are not ...
Definition MotionProperties.h:172
JPH_INLINE Vec3 GetAccumulatedTorque() const
Definition MotionProperties.h:135
void ApplyGyroscopicForceInternal(QuatArg inBodyRotation, float inDeltaTime)
Apply the gyroscopic force (aka Dzhanibekov effect, see https://en.wikipedia.org/wiki/Tennis_racket_t...
Definition MotionProperties.inl:92
Mat44 GetLocalSpaceInverseInertiaUnchecked() const
Same as GetLocalSpaceInverseInertia() but doesn't check if the body is dynamic.
Definition MotionProperties.inl:46
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:76
void ResetSleepTestSpheres(const RVec3 *inPoints)
Reset spheres to center around inPoints with radius 0.
Definition MotionProperties.inl:144
JPH_INLINE Vec3 GetAccumulatedForce() const
Definition MotionProperties.h:132
JPH_INLINE Vec3 LockTranslation(Vec3Arg inV) const
Takes a translation vector inV and returns a vector where the components that are not allowed by mAll...
Definition MotionProperties.h:159
Mat44 GetInverseInertiaForRotation(Mat44Arg inRotation) const
Get inverse inertia matrix ( ) for a given object rotation (translation will be ignored)....
Definition MotionProperties.inl:59
Mat44 GetLocalSpaceInverseInertia() const
Get inverse inertia matrix ( ). Will be a matrix of zeros for a static or kinematic object.
Definition MotionProperties.inl:53
JPH_INLINE UVec4 GetAngularDOFsMask() const
Returns a vector where the angular components that are not allowed by mAllowedDOFs are set to 0 and t...
Definition MotionProperties.h:165
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:120
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:9
JPH_INLINE Vec4 ReinterpretAsFloat() const
Reinterpret UVec4 as a Vec4 (doesn't change the bits)
Definition UVec4.inl:332
JPH_INLINE Vec4 SplatX() const
Replicate the X component to all components.
Definition Vec3.inl:521
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition Vec3.inl:582
JPH_INLINE Vec4 SplatZ() const
Replicate the Z component to all components.
Definition Vec3.inl:543
static JPH_INLINE Vec3 sAnd(Vec3Arg inV1, Vec3Arg inV2)
Logical and (component wise)
Definition Vec3.inl:310
static JPH_INLINE Vec3 sSelect(Vec3Arg inV1, Vec3Arg inV2, UVec4Arg inControl)
Component wise select, returns inV1 when highest bit of inControl = 0 and inV2 when highest bit of in...
Definition Vec3.inl:269
JPH_INLINE Vec4 SplatY() const
Replicate the Y component to all components.
Definition Vec3.inl:532
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition Vec3.inl:653
static JPH_INLINE UVec4 sEquals(Vec3Arg inV1, Vec3Arg inV2)
Equals (component wise)
Definition Vec3.inl:177
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107
static JPH_INLINE Vec3 sReplicate(float inV)
Replicate inV across all components.
Definition Vec3.inl:118
static JPH_INLINE Vec4 sAnd(Vec4Arg inV1, Vec4Arg inV2)
Logical and (component wise)
Definition Vec4.inl:290