25#ifdef JPH_DEBUG_RENDERER
82 void SetPressure(
float inPressure) { mPressure = inPressure; }
108 float GetVolume()
const {
return GetVolumeTimesSix() / 6.0f; }
113#ifdef JPH_DEBUG_RENDERER
140 void SkinVertices(
RMat44Arg inCenterOfMassTransform,
const Mat44 *inJointMatrices,
uint inNumJoints,
bool inHardSkinAll,
TempAllocator &ioTempAllocator);
186 LeafShape() =
default;
187 LeafShape(
Mat44Arg inTransform,
Vec3Arg inScale,
const Shape *inShape) : mTransform(inTransform), mScale(inScale), mShape(inShape) { }
195 struct CollidingShape
198 Vec3 GetPointVelocity(
Vec3Arg inPointRelativeToCOM)
const
200 return mLinearVelocity + mAngularVelocity.
Cross(inPointRelativeToCOM);
203 Mat44 mCenterOfMassTransform;
210 float mSoftBodyInvMassScale;
211 bool mUpdateVelocities;
213 Vec3 mLinearVelocity;
214 Vec3 mAngularVelocity;
215 Vec3 mOriginalLinearVelocity;
216 Vec3 mOriginalAngularVelocity;
220 struct CollidingSensor
222 Mat44 mCenterOfMassTransform;
234 Vec3 mAngularVelocity;
235 Quat mPreviousRotationInternal;
248 void DetermineCollisionPlanes(
uint inVertexStart,
uint inNumVertices);
251 void DetermineSensorCollisions(CollidingSensor &ioSensor);
276 void ApplyLRAConstraints(
uint inStartIndex,
uint inEndIndex);
303 float GetVolumeTimesSix()
const;
305#ifdef JPH_DEBUG_RENDERER
307 template <
typename GetEndIndex,
typename DrawConstra
int>
308 inline void DrawConstraints(
ESoftBodyConstraintColor inConstraintColor,
const GetEndIndex &inGetEndIndex,
const DrawConstraint &inDrawConstraint,
ColorArg inBaseColor)
const;
320 AABox mLocalPredictedBounds;
324 float mSkinnedMaxDistanceMultiplier = 1.0f;
325 float mVertexRadius = 0.0f;
326 bool mUpdatePosition;
327 bool mFacesDoubleSided;
328 atomic<bool> mNeedContactCallback =
false;
329 bool mEnableSkinConstraints =
true;
330 bool mSkinStatePreviousPositionValid =
false;
@ CalculateMassAndInertia
Tells the system to calculate the mass and inertia based on density.
ESoftBodyConstraintColor
Defines how to color soft body constraints.
Definition BodyManager.h:28
#define JPH_EXPORT
Definition Core.h:275
unsigned int uint
Definition Core.h:492
#define JPH_NAMESPACE_END
Definition Core.h:419
std::uint32_t uint32
Definition Core.h:495
#define JPH_NAMESPACE_BEGIN
Definition Core.h:413
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
EMotionType
Motion type of a physics body.
Definition MotionType.h:11
Axis aligned box.
Definition AABox.h:16
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition BodyID.h:13
Definition BodyInterface.h:36
Base class interface for locking a body. Usually you will use BodyLockRead / BodyLockWrite / BodyLock...
Definition BodyLockInterface.h:17
Class that holds an RGBA color with 8-bits per component.
Definition Color.h:16
Definition DebugRenderer.h:47
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
static JPH_INLINE Mat44 sIdentity()
Identity matrix.
Definition Mat44.inl:35
The Body class only keeps track of state for static bodies, the MotionProperties class keeps the addi...
Definition MotionProperties.h:29
void RestoreState(StateRecorder &inStream)
Restoring state for replay.
Definition MotionProperties.cpp:78
void SaveState(StateRecorder &inStream) const
Saving state for replay.
Definition MotionProperties.cpp:63
Definition PhysicsSystem.h:30
Definition Reference.h:163
Base class for all shapes (collision volume of a body). Defines a virtual interface for collision det...
Definition Shape.h:186
Definition SoftBodyCreationSettings.h:18
An interface to query which vertices of a soft body are colliding with other bodies.
Definition SoftBodyManifold.h:13
This class contains the runtime information of a soft body.
Definition SoftBodyMotionProperties.h:35
bool GetEnableSkinConstraints() const
Global setting to turn on/off skin constraints.
Definition SoftBodyMotionProperties.h:93
Vertex & GetVertex(uint inIndex)
Definition SoftBodyMotionProperties.h:61
EStatus
Return code for ParallelUpdate.
Definition SoftBodyMotionProperties.h:167
Array< Vertex > & GetVertices()
Definition SoftBodyMotionProperties.h:57
void SetSkinnedMaxDistanceMultiplier(float inSkinnedMaxDistanceMultiplier)
Definition SoftBodyMotionProperties.h:98
const PhysicsMaterialList & GetMaterials() const
Get the materials of the soft body.
Definition SoftBodyMotionProperties.h:68
const Array< Vertex > & GetVertices() const
Get the vertices of the soft body.
Definition SoftBodyMotionProperties.h:56
bool GetFacesDoubleSided() const
If the faces in this soft body should be treated as double sided for the purpose of collision detecti...
Definition SoftBodyMotionProperties.h:89
void SetUpdatePosition(bool inUpdatePosition)
Definition SoftBodyMotionProperties.h:86
float GetSkinnedMaxDistanceMultiplier() const
Multiplier applied to Skinned::mMaxDistance to allow tightening or loosening of the skin constraints....
Definition SoftBodyMotionProperties.h:97
void SetPressure(float inPressure)
Definition SoftBodyMotionProperties.h:82
void SetFacesDoubleSided(bool inDoubleSided)
Definition SoftBodyMotionProperties.h:90
const Array< Face > & GetFaces() const
Get the faces of the soft body.
Definition SoftBodyMotionProperties.h:71
const AABox & GetLocalBounds() const
Get local bounding box.
Definition SoftBodyMotionProperties.h:105
const Vertex & GetVertex(uint inIndex) const
Access an individual vertex.
Definition SoftBodyMotionProperties.h:60
void SetNumIterations(uint32 inNumIterations)
Definition SoftBodyMotionProperties.h:78
float GetVertexRadius() const
How big the particles are, can be used to push the vertices a little bit away from the surface of oth...
Definition SoftBodyMotionProperties.h:101
Quat GetRodRotation(uint inIndex) const
Access to the state of rods.
Definition SoftBodyMotionProperties.h:64
Vec3 GetRodAngularVelocity(uint inIndex) const
Definition SoftBodyMotionProperties.h:65
void SetVertexRadius(float inVertexRadius)
Definition SoftBodyMotionProperties.h:102
bool GetUpdatePosition() const
Update the position of the body while simulating (set to false for something that is attached to the ...
Definition SoftBodyMotionProperties.h:85
float GetVolume() const
Get the volume of the soft body. Note can become negative if the shape is inside out!
Definition SoftBodyMotionProperties.h:108
uint32 GetNumIterations() const
Get the number of solver iterations.
Definition SoftBodyMotionProperties.h:77
float GetPressure() const
Get the pressure of the soft body.
Definition SoftBodyMotionProperties.h:81
void SetEnableSkinConstraints(bool inEnableSkinConstraints)
Definition SoftBodyMotionProperties.h:94
const SoftBodySharedSettings * GetSettings() const
Get the shared settings of the soft body.
Definition SoftBodyMotionProperties.h:53
const Face & GetFace(uint inIndex) const
Access to an individual face.
Definition SoftBodyMotionProperties.h:74
An inverse bind matrix take a skinned vertex from its bind pose into joint local space.
Definition SoftBodySharedSettings.h:226
Definition SoftBodySharedSettings.h:290
A joint and its skin weight.
Definition SoftBodySharedSettings.h:240
A constraint that skins a vertex to joints and limits the distance that the simulated vertex can trav...
Definition SoftBodySharedSettings.h:254
Definition SoftBodySharedSettings.h:16
Temporary data used by the update of a soft body.
Definition SoftBodyUpdateContext.h:19
Definition SoftBodyVertex.h:16
Definition StateRecorder.h:110
Definition TempAllocator.h:16
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition Vec3.inl:595
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:103
static JPH_INLINE Vec3 sNaN()
Vector with all NaN's.
Definition Vec3.inl:130
Definition PhysicsSettings.h:28
Definition SoftBodySharedSettings.h:192
An edge keeps two vertices at a constant distance using a spring: |x1 - x2| = rest length.
Definition SoftBodySharedSettings.h:158
A face defines the surface of the body.
Definition SoftBodySharedSettings.h:142
A constraint that connects two Cosserat rods and limits bend and twist between the rods.
Definition SoftBodySharedSettings.h:332
Definition SoftBodySharedSettings.h:313
Volume constraint, keeps the volume of a tetrahedron constant.
Definition SoftBodySharedSettings.h:209