11 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess(), BodyAccess::EAccess::Read));
18 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess(), BodyAccess::EAccess::Read));
25 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess(), BodyAccess::EAccess::Read));
72 JPH_ASSERT(inBody1.
GetID() != inBody2.
GetID(),
"Read the comment above, A and B are the same body which should not be possible!");
84 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess(), BodyAccess::EAccess::ReadWrite));
92 float len = inAngularVelocityTimesDeltaTime.
Length();
95 mRotation = (
Quat::sRotation(inAngularVelocityTimesDeltaTime / len, len) * mRotation).Normalized();
103 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess(), BodyAccess::EAccess::ReadWrite));
106 float len = inAngularVelocityTimesDeltaTime.
Length();
109 mRotation = (
Quat::sRotation(inAngularVelocityTimesDeltaTime / len, -len) * mRotation).Normalized();
146 SetAngularVelocityClamped(mMotionProperties->GetAngularVelocity() + mMotionProperties->MultiplyWorldSpaceInverseInertiaByVector(mRotation,
Vec3(inPosition - mPosition).Cross(inImpulse)));
153 SetAngularVelocityClamped(mMotionProperties->GetAngularVelocity() + mMotionProperties->MultiplyWorldSpaceInverseInertiaByVector(mRotation, inAngularImpulse));
156void Body::GetSleepTestPoints(
RVec3 *outPoints)
const
158 JPH_ASSERT(BodyAccess::sCheckRights(BodyAccess::sPositionAccess(), BodyAccess::EAccess::Read));
161 outPoints[0] = mPosition;
167 switch (lowest_component)
170 outPoints[1] = mPosition + extent.
GetY() * rotation.
GetColumn3(1);
171 outPoints[2] = mPosition + extent.
GetZ() * rotation.
GetColumn3(2);
175 outPoints[1] = mPosition + extent.
GetX() * rotation.
GetColumn3(0);
176 outPoints[2] = mPosition + extent.
GetZ() * rotation.
GetColumn3(2);
180 outPoints[1] = mPosition + extent.
GetX() * rotation.
GetColumn3(0);
181 outPoints[2] = mPosition + extent.
GetY() * rotation.
GetColumn3(1);
193 GetSleepTestPoints(points);
194 mMotionProperties->ResetSleepTestSpheres(points);
#define JPH_NAMESPACE_END
Definition Core.h:425
std::uint32_t uint32
Definition Core.h:503
#define JPH_NAMESPACE_BEGIN
Definition Core.h:419
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
const Vec3 Vec3Arg
Definition MathTypes.h:19
Vec3Arg RVec3Arg
Definition Real.h:30
Mat44 RMat44
Definition Real.h:31
Vec3 RVec3
Definition Real.h:29
Vec3 GetExtent() const
Get extent of bounding box (half of the size).
Definition AABox.h:120
const MotionProperties * GetMotionProperties() const
Access to the motion properties.
Definition Body.h:308
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.
Definition Body.inl:114
bool IsDynamic() const
Check if this body is dynamic, which means that it moves and forces can act on it.
Definition Body.h:67
bool IsSensor() const
Check if this body is a sensor.
Definition Body.h:80
void AddRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Update rotation using an Euler step (used during position integrate & constraint solving).
Definition Body.inl:81
bool IsSoftBody() const
Check if this body is a soft body.
Definition Body.h:53
RMat44 GetWorldTransform() const
Calculates the transform of this body.
Definition Body.inl:9
const CollisionGroup & GetCollisionGroup() const
Collision group and sub-group ID, determines which other objects it collides with.
Definition Body.h:130
void SetLinearVelocityClamped(Vec3Arg inLinearVelocity)
Definition Body.h:158
JPH_TSAN_NO_SANITIZE uint32 GetIndexInActiveBodiesInternal() const
Access to the index in the BodyManager::mActiveBodies list.
Definition Body.h:380
static constexpr uint32 cInactiveIndex
Constant indicating that body is not active.
Definition Body.h:393
static bool sFindCollidingPairsCanCollide(const Body &inBody1, const Body &inBody2)
Definition Body.inl:30
Mat44 GetInverseInertia() const
Get inverse inertia tensor in world space.
Definition Body.inl:120
bool IsRigidBody() const
Check if this body is a rigid body.
Definition Body.h:50
bool IsStatic() const
Check if this body is static (not movable).
Definition Body.h:61
bool GetCollideKinematicVsNonDynamic() const
Check if kinematic objects can generate contact points against other kinematic or static objects.
Definition Body.h:88
void SetAngularVelocityClamped(Vec3Arg inAngularVelocity)
Definition Body.h:169
RMat44 GetCenterOfMassTransform() const
Calculates the transform for this body's center of mass.
Definition Body.inl:16
void ResetSleepTimer()
Resets the sleep timer. This does not wake up the body if it is sleeping, but allows resetting the sy...
Definition Body.inl:190
RMat44 GetInverseCenterOfMassTransform() const
Calculates the inverse of the transform for this body's center of mass.
Definition Body.inl:23
void AddAngularImpulse(Vec3Arg inAngularImpulse)
Definition Body.inl:149
void SubRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Definition Body.inl:100
bool IsKinematic() const
Check if this body is kinematic (keyframed), which means that it will move according to its current v...
Definition Body.h:64
JPH_OVERRIDE_NEW_DELETE const BodyID & GetID() const
Get the id of this body.
Definition Body.h:44
void AddForce(Vec3Arg inForce)
Definition Body.h:179
void AddTorque(Vec3Arg inTorque)
Definition Body.h:187
void AddImpulse(Vec3Arg inImpulse)
Definition Body.inl:133
bool CanCollide(const CollisionGroup &inOther) const
Check if this object collides with another object.
Definition CollisionGroup.h:71
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 PreTranslated(Vec3Arg inTranslation) const
Pre multiply by translation matrix: result = this * Mat44::sTranslation(inTranslation).
Definition Mat44.inl:898
JPH_INLINE Vec3 Multiply3x3Transposed(Vec3Arg inV) const
Multiply vector by only 3x3 part of the transpose of the matrix ( ).
Definition Mat44.inl:336
JPH_INLINE Vec3 GetColumn3(uint inCol) const
Definition Mat44.h:158
static JPH_INLINE Mat44 sRotationTranslation(QuatArg inR, Vec3Arg inT)
Get matrix that rotates and translates.
Definition Mat44.inl:149
static JPH_INLINE Mat44 sRotation(Vec3Arg inAxis, float inAngle)
Rotate around arbitrary axis.
Definition Mat44.inl:139
static JPH_INLINE Mat44 sInverseRotationTranslation(QuatArg inR, Vec3Arg inT)
Get inverse matrix of sRotationTranslation.
Definition Mat44.inl:156
Mat44 GetInverseInertiaForRotation(Mat44Arg inRotation) const
Get inverse inertia matrix ( ) for a given object rotation (translation will be ignored)....
Definition MotionProperties.inl:69
static JPH_INLINE Quat sRotation(Vec3Arg inAxis, float inAngle)
Rotation from axis and angle.
Definition Quat.inl:128
virtual AABox GetLocalBounds() const =0
Get local bounding box including convex radius, this box is centered around the center of mass rather...
A sub shape id contains a path to an element (usually a triangle or other primitive type) of a compou...
Definition SubShapeID.h:23
JPH_INLINE Vec3 Normalized() const
Normalize vector.
Definition Vec3.inl:707
JPH_INLINE float GetX() const
Get individual components.
Definition Vec3.h:127
JPH_INLINE float Length() const
Length of vector.
Definition Vec3.inl:682
JPH_INLINE int GetLowestComponentIndex() const
Get index of component with lowest value.
Definition Vec3.inl:567
JPH_INLINE float GetY() const
Definition Vec3.h:128
JPH_INLINE float GetZ() const
Definition Vec3.h:129