SoftBodySharedSettings.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2023 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Jolt/Core/Reference.h>
  6. #include <Jolt/Physics/Collision/PhysicsMaterial.h>
  7. #include <Jolt/Core/StreamUtils.h>
  8. JPH_NAMESPACE_BEGIN
  9. /// This class defines the setup of all particles and their constraints.
  10. /// It is used during the simulation and can be shared between multiple soft bodies.
  11. class JPH_EXPORT SoftBodySharedSettings : public RefTarget<SoftBodySharedSettings>
  12. {
  13. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, SoftBodySharedSettings)
  14. public:
  15. /// Which type of bend constraint should be created
  16. enum class EBendType
  17. {
  18. None, ///< No bend constraints will be created
  19. Distance, ///< A simple distance constraint
  20. Dihedral, ///< A dihedral bend constraint (most expensive, but also supports triangles that are initially not in the same plane)
  21. };
  22. /// The type of long range attachment constraint to create
  23. enum class ELRAType
  24. {
  25. None, ///< Don't create a LRA constraint
  26. EuclideanDistance, ///< Create a LRA constraint based on Euclidean distance between the closest kinematic vertex and this vertex
  27. GeodesicDistance, ///< Create a LRA constraint based on the geodesic distance between the closest kinematic vertex and this vertex (follows the edge constraints)
  28. };
  29. /// Per vertex attributes used during the CreateConstraints function.
  30. /// For an edge or shear constraint, the compliance is averaged between the two attached vertices.
  31. /// For a bend constraint, the compliance is averaged between the two vertices on the shared edge.
  32. struct JPH_EXPORT VertexAttributes
  33. {
  34. /// Constructor
  35. VertexAttributes() = default;
  36. VertexAttributes(float inCompliance, float inShearCompliance, float inBendCompliance, ELRAType inLRAType = ELRAType::None, float inLRAMaxDistanceMultiplier = 1.0f) : mCompliance(inCompliance), mShearCompliance(inShearCompliance), mBendCompliance(inBendCompliance), mLRAType(inLRAType), mLRAMaxDistanceMultiplier(inLRAMaxDistanceMultiplier) { }
  37. float mCompliance = 0.0f; ///< The compliance of the normal edges. Set to FLT_MAX to disable regular edges for any edge involving this vertex.
  38. float mShearCompliance = 0.0f; ///< The compliance of the shear edges. Set to FLT_MAX to disable shear edges for any edge involving this vertex.
  39. float mBendCompliance = FLT_MAX; ///< The compliance of the bend edges. Set to FLT_MAX to disable bend edges for any bend constraint involving this vertex.
  40. ELRAType mLRAType = ELRAType::None; ///< The type of long range attachment constraint to create.
  41. float mLRAMaxDistanceMultiplier = 1.0f; ///< Multiplier for the max distance of the LRA constraint, e.g. 1.01 means the max distance is 1% longer than the calculated distance in the rest pose.
  42. };
  43. /// Automatically create constraints based on the faces of the soft body
  44. /// @param inVertexAttributes A list of attributes for each vertex (1-on-1 with mVertices, note that if the list is smaller than mVertices the last element will be repeated). This defines the properties of the constraints that are created.
  45. /// @param inVertexAttributesLength The length of inVertexAttributes
  46. /// @param inBendType The type of bend constraint to create
  47. /// @param inAngleTolerance Shear edges are created when two connected triangles form a quad (are roughly in the same plane and form a square with roughly 90 degree angles). This defines the tolerance (in radians).
  48. void CreateConstraints(const VertexAttributes *inVertexAttributes, uint inVertexAttributesLength, EBendType inBendType = EBendType::Distance, float inAngleTolerance = DegreesToRadians(8.0f));
  49. /// Calculate the initial lengths of all springs of the edges of this soft body (if you use CreateConstraint, this is already done)
  50. void CalculateEdgeLengths();
  51. /// Calculate the properties of the rods
  52. /// Note that this can swap mVertex of the RodStretchShear constraints if two rods are connected through a RodBendTwist constraint but point in opposite directions.
  53. void CalculateRodProperties();
  54. /// Calculate the max lengths for the long range attachment constraints based on Euclidean distance (if you use CreateConstraints, this is already done)
  55. /// @param inMaxDistanceMultiplier Multiplier for the max distance of the LRA constraint, e.g. 1.01 means the max distance is 1% longer than the calculated distance in the rest pose.
  56. void CalculateLRALengths(float inMaxDistanceMultiplier = 1.0f);
  57. /// Calculate the constants for the bend constraints (if you use CreateConstraints, this is already done)
  58. void CalculateBendConstraintConstants();
  59. /// Calculates the initial volume of all tetrahedra of this soft body
  60. void CalculateVolumeConstraintVolumes();
  61. /// Calculate information needed to be able to calculate the skinned constraint normals at run-time
  62. void CalculateSkinnedConstraintNormals();
  63. /// Information about the optimization of the soft body, the indices of certain elements may have changed.
  64. class OptimizationResults
  65. {
  66. public:
  67. Array<uint> mEdgeRemap; ///< Maps old edge index to new edge index
  68. Array<uint> mLRARemap; ///< Maps old LRA index to new LRA index
  69. Array<uint> mRodStretchShearConstraintRemap; ///< Maps old rod stretch shear constraint index to new stretch shear rod constraint index
  70. Array<uint> mRodBendTwistConstraintRemap; ///< Maps old rod bend twist constraint index to new bend twist rod constraint index
  71. Array<uint> mDihedralBendRemap; ///< Maps old dihedral bend index to new dihedral bend index
  72. Array<uint> mVolumeRemap; ///< Maps old volume constraint index to new volume constraint index
  73. Array<uint> mSkinnedRemap; ///< Maps old skinned constraint index to new skinned constraint index
  74. };
  75. /// Optimize the soft body settings for simulation. This will reorder constraints so they can be executed in parallel.
  76. void Optimize(OptimizationResults &outResults);
  77. /// Optimize the soft body settings without results
  78. void Optimize() { OptimizationResults results; Optimize(results); }
  79. /// Clone this object
  80. Ref<SoftBodySharedSettings> Clone() const;
  81. /// Saves the state of this object in binary form to inStream. Doesn't store the material list.
  82. void SaveBinaryState(StreamOut &inStream) const;
  83. /// Restore the state of this object from inStream. Doesn't restore the material list.
  84. void RestoreBinaryState(StreamIn &inStream);
  85. using SharedSettingsToIDMap = StreamUtils::ObjectToIDMap<SoftBodySharedSettings>;
  86. using IDToSharedSettingsMap = StreamUtils::IDToObjectMap<SoftBodySharedSettings>;
  87. using MaterialToIDMap = StreamUtils::ObjectToIDMap<PhysicsMaterial>;
  88. using IDToMaterialMap = StreamUtils::IDToObjectMap<PhysicsMaterial>;
  89. /// Save this shared settings and its materials. Pass in an empty map ioSettingsMap / ioMaterialMap or reuse the same map while saving multiple settings objects to the same stream in order to avoid writing duplicates.
  90. void SaveWithMaterials(StreamOut &inStream, SharedSettingsToIDMap &ioSettingsMap, MaterialToIDMap &ioMaterialMap) const;
  91. using SettingsResult = Result<Ref<SoftBodySharedSettings>>;
  92. /// Restore a shape and materials. Pass in an empty map in ioSettingsMap / ioMaterialMap or reuse the same map while reading multiple settings objects from the same stream in order to restore duplicates.
  93. static SettingsResult sRestoreWithMaterials(StreamIn &inStream, IDToSharedSettingsMap &ioSettingsMap, IDToMaterialMap &ioMaterialMap);
  94. /// Create a cube. This can be used to create a simple soft body for testing purposes.
  95. /// It will contain edge constraints, volume constraints and faces.
  96. /// @param inGridSize Number of points along each axis
  97. /// @param inGridSpacing Distance between points
  98. static Ref<SoftBodySharedSettings> sCreateCube(uint inGridSize, float inGridSpacing);
  99. /// A vertex is a particle, the data in this structure is only used during creation of the soft body and not during simulation
  100. struct JPH_EXPORT Vertex
  101. {
  102. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Vertex)
  103. /// Constructor
  104. Vertex() = default;
  105. Vertex(const Float3 &inPosition, const Float3 &inVelocity = Float3(0, 0, 0), float inInvMass = 1.0f) : mPosition(inPosition), mVelocity(inVelocity), mInvMass(inInvMass) { }
  106. Float3 mPosition { 0, 0, 0 }; ///< Initial position of the vertex
  107. Float3 mVelocity { 0, 0, 0 }; ///< Initial velocity of the vertex
  108. float mInvMass = 1.0f; ///< Initial inverse of the mass of the vertex
  109. };
  110. /// A face defines the surface of the body
  111. struct JPH_EXPORT Face
  112. {
  113. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Face)
  114. /// Constructor
  115. Face() = default;
  116. Face(uint32 inVertex1, uint32 inVertex2, uint32 inVertex3, uint32 inMaterialIndex = 0) : mVertex { inVertex1, inVertex2, inVertex3 }, mMaterialIndex(inMaterialIndex) { }
  117. /// Check if this is a degenerate face (a face which points to the same vertex twice)
  118. bool IsDegenerate() const { return mVertex[0] == mVertex[1] || mVertex[0] == mVertex[2] || mVertex[1] == mVertex[2]; }
  119. uint32 mVertex[3]; ///< Indices of the vertices that form the face
  120. uint32 mMaterialIndex = 0; ///< Index of the material of the face in SoftBodySharedSettings::mMaterials
  121. };
  122. /// An edge keeps two vertices at a constant distance using a spring: |x1 - x2| = rest length
  123. struct JPH_EXPORT Edge
  124. {
  125. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Edge)
  126. /// Constructor
  127. Edge() = default;
  128. Edge(uint32 inVertex1, uint32 inVertex2, float inCompliance = 0.0f) : mVertex { inVertex1, inVertex2 }, mCompliance(inCompliance) { }
  129. /// Return the lowest vertex index of this constraint
  130. uint32 GetMinVertexIndex() const { return min(mVertex[0], mVertex[1]); }
  131. uint32 mVertex[2]; ///< Indices of the vertices that form the edge
  132. float mRestLength = 1.0f; ///< Rest length of the spring, calculated by CalculateEdgeLengths
  133. float mCompliance = 0.0f; ///< Inverse of the stiffness of the spring
  134. };
  135. /**
  136. * A dihedral bend constraint keeps the angle between two triangles constant along their shared edge.
  137. *
  138. * x2
  139. * / \
  140. * / t0 \
  141. * x0----x1
  142. * \ t1 /
  143. * \ /
  144. * x3
  145. *
  146. * x0..x3 are the vertices, t0 and t1 are the triangles that share the edge x0..x1
  147. *
  148. * Based on:
  149. * - "Position Based Dynamics" - Matthias Muller et al.
  150. * - "Strain Based Dynamics" - Matthias Muller et al.
  151. * - "Simulation of Clothing with Folds and Wrinkles" - R. Bridson et al.
  152. */
  153. struct JPH_EXPORT DihedralBend
  154. {
  155. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, DihedralBend)
  156. /// Constructor
  157. DihedralBend() = default;
  158. DihedralBend(uint32 inVertex1, uint32 inVertex2, uint32 inVertex3, uint32 inVertex4, float inCompliance = 0.0f) : mVertex { inVertex1, inVertex2, inVertex3, inVertex4 }, mCompliance(inCompliance) { }
  159. /// Return the lowest vertex index of this constraint
  160. uint32 GetMinVertexIndex() const { return min(min(mVertex[0], mVertex[1]), min(mVertex[2], mVertex[3])); }
  161. uint32 mVertex[4]; ///< Indices of the vertices of the 2 triangles that share an edge (the first 2 vertices are the shared edge)
  162. float mCompliance = 0.0f; ///< Inverse of the stiffness of the constraint
  163. float mInitialAngle = 0.0f; ///< Initial angle between the normals of the triangles (pi - dihedral angle), calculated by CalculateBendConstraintConstants
  164. };
  165. /// Volume constraint, keeps the volume of a tetrahedron constant
  166. struct JPH_EXPORT Volume
  167. {
  168. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Volume)
  169. /// Constructor
  170. Volume() = default;
  171. Volume(uint32 inVertex1, uint32 inVertex2, uint32 inVertex3, uint32 inVertex4, float inCompliance = 0.0f) : mVertex { inVertex1, inVertex2, inVertex3, inVertex4 }, mCompliance(inCompliance) { }
  172. /// Return the lowest vertex index of this constraint
  173. uint32 GetMinVertexIndex() const { return min(min(mVertex[0], mVertex[1]), min(mVertex[2], mVertex[3])); }
  174. uint32 mVertex[4]; ///< Indices of the vertices that form the tetrahedron
  175. float mSixRestVolume = 1.0f; ///< 6 times the rest volume of the tetrahedron, calculated by CalculateVolumeConstraintVolumes
  176. float mCompliance = 0.0f; ///< Inverse of the stiffness of the constraint
  177. };
  178. /// An inverse bind matrix take a skinned vertex from its bind pose into joint local space
  179. class JPH_EXPORT InvBind
  180. {
  181. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, InvBind)
  182. public:
  183. /// Constructor
  184. InvBind() = default;
  185. InvBind(uint32 inJointIndex, Mat44Arg inInvBind) : mJointIndex(inJointIndex), mInvBind(inInvBind) { }
  186. uint32 mJointIndex = 0; ///< Joint index to which this is attached
  187. Mat44 mInvBind = Mat44::sIdentity(); ///< The inverse bind matrix, this takes a vertex in its bind pose (Vertex::mPosition) to joint local space
  188. };
  189. /// A joint and its skin weight
  190. class JPH_EXPORT SkinWeight
  191. {
  192. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, SkinWeight)
  193. public:
  194. /// Constructor
  195. SkinWeight() = default;
  196. SkinWeight(uint32 inInvBindIndex, float inWeight) : mInvBindIndex(inInvBindIndex), mWeight(inWeight) { }
  197. uint32 mInvBindIndex = 0; ///< Index in mInvBindMatrices
  198. float mWeight = 0.0f; ///< Weight with which it is skinned
  199. };
  200. /// A constraint that skins a vertex to joints and limits the distance that the simulated vertex can travel from this vertex
  201. class JPH_EXPORT Skinned
  202. {
  203. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, Skinned)
  204. public:
  205. /// Constructor
  206. Skinned() = default;
  207. Skinned(uint32 inVertex, float inMaxDistance, float inBackStopDistance, float inBackStopRadius) : mVertex(inVertex), mMaxDistance(inMaxDistance), mBackStopDistance(inBackStopDistance), mBackStopRadius(inBackStopRadius) { }
  208. /// Normalize the weights so that they add up to 1
  209. void NormalizeWeights()
  210. {
  211. // Get the total weight
  212. float total = 0.0f;
  213. for (const SkinWeight &w : mWeights)
  214. total += w.mWeight;
  215. // Normalize
  216. if (total > 0.0f)
  217. for (SkinWeight &w : mWeights)
  218. w.mWeight /= total;
  219. }
  220. /// Maximum number of skin weights
  221. static constexpr uint cMaxSkinWeights = 4;
  222. uint32 mVertex = 0; ///< Index in mVertices which indicates which vertex is being skinned
  223. SkinWeight mWeights[cMaxSkinWeights]; ///< Skin weights, the bind pose of the vertex is assumed to be stored in Vertex::mPosition. The first weight that is zero indicates the end of the list. Weights should add up to 1.
  224. float mMaxDistance = FLT_MAX; ///< Maximum distance that this vertex can reach from the skinned vertex, disabled when FLT_MAX. 0 when you want to hard skin the vertex to the skinned vertex.
  225. float mBackStopDistance = FLT_MAX; ///< Disabled if mBackStopDistance >= mMaxDistance. The faces surrounding mVertex determine an average normal. mBackStopDistance behind the vertex in the opposite direction of this normal, the back stop sphere starts. The simulated vertex will be pushed out of this sphere and it can be used to approximate the volume of the skinned mesh behind the skinned vertex.
  226. float mBackStopRadius = 40.0f; ///< Radius of the backstop sphere. By default this is a fairly large radius so the sphere approximates a plane.
  227. uint32 mNormalInfo = 0; ///< Information needed to calculate the normal of this vertex, lowest 24 bit is start index in mSkinnedConstraintNormals, highest 8 bit is number of faces (generated by CalculateSkinnedConstraintNormals)
  228. };
  229. /// A long range attachment constraint, this is a constraint that sets a max distance between a kinematic vertex and a dynamic vertex
  230. /// See: "Long Range Attachments - A Method to Simulate Inextensible Clothing in Computer Games", Tae-Yong Kim, Nuttapong Chentanez and Matthias Mueller-Fischer
  231. class JPH_EXPORT LRA
  232. {
  233. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, LRA)
  234. public:
  235. /// Constructor
  236. LRA() = default;
  237. LRA(uint32 inVertex1, uint32 inVertex2, float inMaxDistance) : mVertex { inVertex1, inVertex2 }, mMaxDistance(inMaxDistance) { }
  238. /// Return the lowest vertex index of this constraint
  239. uint32 GetMinVertexIndex() const { return min(mVertex[0], mVertex[1]); }
  240. uint32 mVertex[2]; ///< The vertices that are connected. The first vertex should be kinematic, the 2nd dynamic.
  241. float mMaxDistance = 0.0f; ///< The maximum distance between the vertices, calculated by CalculateLRALengths
  242. };
  243. /// A discrete Cosserat rod connects two particles with a rigid rod that has fixed length and inertia.
  244. /// A rod can be used instead of an Edge to constraint two vertices. The orientation of the rod can be
  245. /// used to orient geometry attached to the rod (e.g. a plant leaf). Note that each rod needs to be constrained
  246. /// by at least one RodBendTwist constraint in order to constrain the rotation of the rod. If you don't do
  247. /// this then the orientation is likely to rotate around the rod axis with constant velocity.
  248. /// Based on "Position and Orientation Based Cosserat Rods" - Kugelstadt and Schoemer - SIGGRAPH 2016
  249. /// See: https://www.researchgate.net/publication/325597548_Position_and_Orientation_Based_Cosserat_Rods
  250. struct JPH_EXPORT RodStretchShear
  251. {
  252. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, RodStretchShear)
  253. /// Constructor
  254. RodStretchShear() = default;
  255. RodStretchShear(uint32 inVertex1, uint32 inVertex2, float inCompliance = 0.0f) : mVertex { inVertex1, inVertex2 }, mCompliance(inCompliance) { }
  256. /// Return the lowest vertex index of this constraint
  257. uint32 GetMinVertexIndex() const { return min(mVertex[0], mVertex[1]); }
  258. uint32 mVertex[2]; ///< Indices of the vertices that form the rod
  259. float mLength = 1.0f; ///< Fixed length of the rod, calculated by CalculateRodProperties
  260. float mInvMass = 1.0f; ///< Inverse of the mass of the rod (0 for static rods), calculated by CalculateRodProperties but can be overridden afterwards
  261. float mCompliance = 0.0f; ///< Inverse of the stiffness of the rod
  262. Quat mBishop = Quat::sZero(); ///< The Bishop frame of the rod (the rotation of the rod in its rest pose so that it has zero twist towards adjacent rods), calculated by CalculateRodProperties
  263. };
  264. /// A constraint that connects two Cosserat rods and limits bend and twist between the rods.
  265. struct JPH_EXPORT RodBendTwist
  266. {
  267. JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(JPH_EXPORT, RodBendTwist)
  268. /// Constructor
  269. RodBendTwist() = default;
  270. RodBendTwist(uint32 inRod1, uint32 inRod2, float inCompliance = 0.0f) : mRod { inRod1, inRod2 }, mCompliance(inCompliance) { }
  271. uint32 mRod[2]; ///< Indices of rods that are constrained (index in mRodStretchShearConstraints)
  272. float mCompliance = 0.0f; ///< Inverse of the stiffness of the rod
  273. Quat mOmega0 = Quat::sZero(); ///< The initial rotation between the rods: rod1.mBishop.Conjugated() * rod2.mBishop, calculated by CalculateRodProperties
  274. };
  275. /// Add a face to this soft body
  276. void AddFace(const Face &inFace) { JPH_ASSERT(!inFace.IsDegenerate()); mFaces.push_back(inFace); }
  277. Array<Vertex> mVertices; ///< The list of vertices or particles of the body
  278. Array<Face> mFaces; ///< The list of faces of the body
  279. Array<Edge> mEdgeConstraints; ///< The list of edges or springs of the body
  280. Array<DihedralBend> mDihedralBendConstraints; ///< The list of dihedral bend constraints of the body
  281. Array<Volume> mVolumeConstraints; ///< The list of volume constraints of the body that keep the volume of tetrahedra in the soft body constant
  282. Array<Skinned> mSkinnedConstraints; ///< The list of vertices that are constrained to a skinned vertex
  283. Array<InvBind> mInvBindMatrices; ///< The list of inverse bind matrices for skinning vertices
  284. Array<LRA> mLRAConstraints; ///< The list of long range attachment constraints
  285. Array<RodStretchShear> mRodStretchShearConstraints; ///< The list of Cosserat rod constraints that connect two vertices and that limit stretch and shear
  286. Array<RodBendTwist> mRodBendTwistConstraints; ///< The list of Cosserat rod constraints that connect two rods and limit the bend and twist
  287. PhysicsMaterialList mMaterials { PhysicsMaterial::sDefault }; ///< The materials of the faces of the body, referenced by Face::mMaterialIndex
  288. private:
  289. friend class SoftBodyMotionProperties;
  290. /// Calculate the closest kinematic vertex array
  291. void CalculateClosestKinematic();
  292. /// Tracks the closest kinematic vertex
  293. struct ClosestKinematic
  294. {
  295. uint32 mVertex = 0xffffffff; ///< Vertex index of closest kinematic vertex
  296. uint32 mHops = 0xffffffff; ///< Number of hops to the closest kinematic vertex
  297. float mDistance = FLT_MAX; ///< Distance to the closest kinematic vertex
  298. };
  299. /// Tracks the end indices of the various constraint groups
  300. struct UpdateGroup
  301. {
  302. uint mEdgeEndIndex; ///< The end index of the edge constraints in this group
  303. uint mLRAEndIndex; ///< The end index of the LRA constraints in this group
  304. uint mRodStretchShearEndIndex; ///< The end index of the rod stretch shear constraints in this group
  305. uint mRodBendTwistEndIndex; ///< The end index of the rod bend twist constraints in this group
  306. uint mDihedralBendEndIndex; ///< The end index of the dihedral bend constraints in this group
  307. uint mVolumeEndIndex; ///< The end index of the volume constraints in this group
  308. uint mSkinnedEndIndex; ///< The end index of the skinned constraints in this group
  309. };
  310. Array<ClosestKinematic> mClosestKinematic; ///< The closest kinematic vertex to each vertex in mVertices
  311. Array<UpdateGroup> mUpdateGroups; ///< The end indices for each group of constraints that can be updated in parallel
  312. Array<uint32> mSkinnedConstraintNormals; ///< A list of indices in the mFaces array used by mSkinnedConstraints, calculated by CalculateSkinnedConstraintNormals
  313. };
  314. JPH_NAMESPACE_END