Package com.jme3.bullet.objects
Class PhysicsSoftBody
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.PhysicsCollisionObject
com.jme3.bullet.objects.PhysicsBody
com.jme3.bullet.objects.PhysicsSoftBody
- All Implemented Interfaces:
- com.jme3.export.Savable,- com.jme3.util.clone.JmeCloneable,- Cloneable,- Comparable<NativePhysicsObject>
A collision object to simulate a soft body, based on Bullet's btSoftBody. It
 is modeled as a mesh of nodes. Unlike other collision objects, the
 CollisionShape is ignored and is typically null.
- 
Field SummaryFieldsFields inherited from class com.jme3.bullet.objects.PhysicsBodymassForStaticFields inherited from class com.jme3.bullet.collision.PhysicsCollisionObjectCOLLISION_GROUP_01, COLLISION_GROUP_02, COLLISION_GROUP_03, COLLISION_GROUP_04, COLLISION_GROUP_05, COLLISION_GROUP_06, COLLISION_GROUP_07, COLLISION_GROUP_08, COLLISION_GROUP_09, COLLISION_GROUP_10, COLLISION_GROUP_11, COLLISION_GROUP_12, COLLISION_GROUP_13, COLLISION_GROUP_14, COLLISION_GROUP_15, COLLISION_GROUP_16, COLLISION_GROUP_NONE, loggerFields inherited from class com.jme3.bullet.NativePhysicsObjectloggerN
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddVelocity(com.jme3.math.Vector3f velocity) Add velocity to this entire body.voidaddVelocity(com.jme3.math.Vector3f velocity, int nodeIndex) Add velocity to the indexed node of this body.voidappendFaces(com.jme3.scene.mesh.IndexBuffer nodeIndices) Append faces to this body.voidappendLinks(com.jme3.scene.mesh.IndexBuffer nodeIndices) Append links to this body.voidappendNodes(FloatBuffer nodeLocations) Append nodes to this body, each with mass=1.voidappendTetras(com.jme3.scene.mesh.IndexBuffer tetrahedra) Append tetrahedra to this body.voidapplyForce(com.jme3.math.Vector3f force) Apply a force that acts uniformly across the entire body.voidapplyForce(com.jme3.math.Vector3f force, int nodeIndex) Apply a force to the indexed node of this body.voidapplyRotation(com.jme3.math.Quaternion rotation) Rotate this body.voidapplyScale(com.jme3.math.Vector3f factors) Scale this body.voidapplyTransform(com.jme3.math.Transform transform) Transform this body.voidapplyTranslation(com.jme3.math.Vector3f offset) Translate this body.com.jme3.bounding.BoundingBoxboundingBox(com.jme3.bounding.BoundingBox storeResult) Calculate the axis-aligned bounding box for this body.voidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned body into a deep-cloned one, using the specified Cloner and original to resolve copied fields.com.jme3.math.Vector3fclusterCenter(int clusterIndex, com.jme3.math.Vector3f storeResult) Copy the center location of the indexed cluster.copyClusterCenters(FloatBuffer storeResult) Copy the center-of-mass locations of all clusters in this body.copyClusterMasses(FloatBuffer storeResult) Copy the masses of all clusters in this body.copyClusterVelocities(FloatBuffer storeResult) Copy the (linear) velocities of all clusters in this body.Copy the node indices of all faces in this body.Copy the node indices of all links in this body.copyLocations(FloatBuffer storeResult) Copy the locations of all nodes in this body.copyMasses(FloatBuffer storeResult) Copy the masses of all nodes in this body.copyNormals(FloatBuffer storeResult) Copy the normal vectors of all nodes in this body.copyTetras(IntBuffer storeResult) Copy the node indices of all tetrahedra in this body.copyVelocities(FloatBuffer storeResult) Copy the (linear) velocities of all nodes in this body.final intCount the clusters in this body.final intCount the faces in this body.final intCount the links in this body.final intCount the nodes in this body.intcountNodesInCluster(int clusterIndex) Count the nodes in the indexed cluster.final intCount the pinned nodes in this body.final intCount the tetrahedra in this body.booleancutLink(int nodeIndex0, int nodeIndex1, float cutLocation) Cut a pre-existing link in this body.protected voidDestroy the pre-existing btSoftBody (if any) except for its worldInfo.voidgenerateBendingConstraints(int numHops, SoftBodyMaterial material) Generate bending constraints based on hops in the adjacency graph.voidGenerate one cluster per tetrahedron (or one per face if there are no tetrahedra).voidgenerateClusters(int k, int maxIterations) Generate clusters (K-mean).floatRead the specified parameter of the indexed cluster.com.jme3.math.Vector3fgetGravity(com.jme3.math.Vector3f storeResult) Copy this body's gravitational acceleration.floatgetMass()Determine the total mass of this body.com.jme3.math.Vector3fgetPhysicsLocation(com.jme3.math.Vector3f storeResult) Locate the center of this body's axis-aligned bounding box.com.simsilica.mathd.Vec3dgetPhysicsLocationDp(com.simsilica.mathd.Vec3d storeResult) Locate the center of this body's axis-aligned bounding box.com.jme3.math.QuaterniongetPhysicsRotation(com.jme3.math.Quaternion storeResult) Copy the orientation (rotation) of this body to a Quaternion.com.simsilica.mathd.QuatdgetPhysicsRotationDp(com.simsilica.mathd.Quatd storeResult) Copy the orientation (rotation) of this body to a Quatd.com.jme3.math.Matrix3fgetPhysicsRotationMatrix(com.jme3.math.Matrix3f storeResult) Copy the orientation of this body (the basis of its local coordinate system) to a Matrix3f.com.simsilica.mathd.Matrix3dgetPhysicsRotationMatrixDp(com.simsilica.mathd.Matrix3d storeResult) Copy the orientation of this body (the basis of its local coordinate system) to a Matrix3d.com.jme3.math.Vector3fgetScale(com.jme3.math.Vector3f storeResult) Copy the scale factors of this object.Access the SoftBodyConfig of this body.Access the Material of this body.Access the world info.protected voidReinitialize the btSoftBody to the default values.booleanisCollisionAllowed(long pcoId) Test whether collisions are allowed between this body and the identified collision object.final booleanisEmpty()Test whether this body is empty.booleanTest whether this body's world info should be replaced when added to a space.listNodesInCluster(int clusterIndex, IntBuffer storeResult) List all nodes in the indexed cluster.floatmargin()Read the collision margin of this body.protected voidCreate an emptybtSoftBodyfor this PhysicsSoftBody, using the pre-existing worldInfo.com.jme3.math.Vector3fnodeLocation(int nodeIndex, com.jme3.math.Vector3f storeResult) Copy the location of the indexed node.floatnodeMass(int nodeIndex) Read the mass of the indexed node.com.jme3.math.Vector3fnodeNormal(int nodeIndex, com.jme3.math.Vector3f storeResult) Copy the normal vector of the indexed node.com.jme3.math.Vector3fnodeVelocity(int nodeIndex, com.jme3.math.Vector3f storeResult) Copy the velocity of the indexed node.voidRandomize constraints to reduce solver bias.voidread(com.jme3.export.JmeImporter importer) De-serialize this body from the specified importer, for example when loading from a J3O file.voidRelease all clusters.voidreleaseCluster(int clusterIndex) Release the indexed cluster.voidSet the resting lengths of all links to their current lengths.floatRead the scale factor for resting lengths.voidAlter the specified parameter of the indexed cluster.voidsetDebugMeshNormals(jme3utilities.MeshNormals newSetting) Alter which normals to include in new debug meshes.voidsetGravity(com.jme3.math.Vector3f acceleration) Alter this body's gravitational acceleration.final voidsetMargin(float margin) Alter the collision margin of this body.voidsetMass(float totalMass) Alter the total mass for this body, distributing it in proportion to the current mass of each node.voidsetMassByArea(float totalMass) Alter the total mass for this body, distributing it based on the area of each face.voidsetMassByCurrent(float totalMass) Alter the total mass for this body, distributing it to nodes in proportion to their current masses.voidsetMasses(FloatBuffer masses) Alter the masses of all nodes.voidsetMassFromDensity(float density) Alter the total mass of this body, weighted by volume.voidsetNodeMass(int nodeIndex, float mass) Alter the mass of the indexed node.voidsetNodeVelocity(int nodeIndex, com.jme3.math.Vector3f velocity) Alter the velocity of the indexed node.voidsetNormals(FloatBuffer normals) Alter the normal vectors of all nodes.voidsetPhysicsLocation(com.jme3.math.Vector3f location) Directly relocate the center of this body's bounding box.voidsetPhysicsLocationDp(com.simsilica.mathd.Vec3d location) Directly relocate the center of this body's bounding box.voidsetPose(boolean setVolumePose, boolean setFramePose) Set the "default pose" (lowest energy state) of this body based on its current pose.voidsetProtectWorldInfo(boolean newState) Alter whether this body's world info should be replaced when the body gets added to a space.voidsetRestingLengthScale(float scale) Alter the scale factor for resting lengths.voidsetVelocities(FloatBuffer velocities) Alter the velocities of all nodes.voidsetVelocity(com.jme3.math.Vector3f velocity) Alter the velocities of all nodes to make them identical.voidsetVolumeDensity(float density) Set volume density (using tetrahedra) TODO clarify semanticsvoidsetVolumeMass(float mass) Set volume mass (using tetrahedra) TODO clarify semanticsvoidsetWindVelocity(com.jme3.math.Vector3f velocity) Alter the wind velocity.voidsetWorldInfo(SoftBodyWorldInfo worldInfo) Replace the world info of this body.floatvolume()Calculate the volume of this body.com.jme3.math.Vector3fwindVelocity(com.jme3.math.Vector3f storeResult) Copy the wind velocity.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this body to the specified exporter, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.objects.PhysicsBodyaddJoint, cloneJoints, countJoints, getDeactivationDeadline, isDeactivationEnabled, listJoints, readJoints, removeJoint, setDeactivationDeadline, setDeactivationEnabled, writeJointsMethods inherited from class com.jme3.bullet.collision.PhysicsCollisionObjectactivate, addCollideWithGroup, addToIgnoreList, attachCollisionShape, clearIgnoreList, cloneIgnoreList, collisionFlags, copyPcoProperties, countIgnored, debugMeshInitListener, debugMeshNormals, debugMeshResolution, debugNumSides, finalizeNative, findInstance, getActivationState, getAnisotropicFriction, getApplicationData, getCcdMotionThreshold, getCcdSquareMotionThreshold, getCcdSweptSphereRadius, getCollideWithGroups, getCollisionGroup, getCollisionShape, getCollisionSpace, getContactDamping, getContactProcessingThreshold, getContactStiffness, getDeactivationTime, getDebugMaterial, getFriction, getInternalType, getPhysicsLocation, getRestitution, getRollingFriction, getSpinningFriction, getTransform, getUserObject, hasAnisotropicFriction, ignores, initUserPointer, isActive, isContactResponse, isInWorld, isStatic, jmeClone, listIgnoredPcos, proxyGroup, proxyMask, readPcoProperties, removeCollideWithGroup, removeFromIgnoreList, setActivationState, setAnisotropicFriction, setApplicationData, setCcdMotionThreshold, setCcdSweptSphereRadius, setCollideWithGroups, setCollisionFlags, setCollisionGroup, setCollisionShape, setContactDamping, setContactProcessingThreshold, setContactStiffness, setDeactivationTime, setDebugMaterial, setDebugMeshInitListener, setDebugMeshResolution, setDebugNumSides, setFriction, setIgnoreList, setLocationAndBasis, setRestitution, setRollingFriction, setSpinningFriction, setUserIndex, setUserIndex2, setUserIndex3, setUserObject, spaceId, toString, userIndex, userIndex2, userIndex3Methods inherited from class com.jme3.bullet.NativePhysicsObjectcompareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, unassignNativeObject
- 
Field Details- 
logger2message logger for this class
 
- 
- 
Constructor Details- 
PhysicsSoftBodypublic PhysicsSoftBody()Instantiate an empty soft body. The new body is not added to any physics space.
 
- 
- 
Method Details- 
addVelocitypublic void addVelocity(com.jme3.math.Vector3f velocity) Add velocity to this entire body.- Parameters:
- velocity- the velocity to add (in physics-space coordinates, not null, unaffected)
 
- 
addVelocitypublic void addVelocity(com.jme3.math.Vector3f velocity, int nodeIndex) Add velocity to the indexed node of this body.- Parameters:
- velocity- the velocity to add (in physics-space coordinates, not null, unaffected)
- nodeIndex- which node to add it to (≥0, <numNodes)
 
- 
appendFacespublic void appendFaces(com.jme3.scene.mesh.IndexBuffer nodeIndices) Append faces to this body. A Face is a triangle connecting 3 nodes.- Parameters:
- nodeIndices- a face is created for every 3 indices in this buffer (not null, direct, size a multiple of 3)
 
- 
appendLinkspublic void appendLinks(com.jme3.scene.mesh.IndexBuffer nodeIndices) Append links to this body. A link is an interaction (or force) between 2 nodes.- Parameters:
- nodeIndices- a link is created for each pair of indices in this buffer (not null, direct, size a multiple of 2)
 
- 
appendNodesAppend nodes to this body, each with mass=1. Nodes provide the shape of a soft body. Each node has its own location, velocity, mass, etcetera.- Parameters:
- nodeLocations- a node is created for every 3 floats in this buffer (not null, direct, limit a multiple of 3)
 
- 
appendTetraspublic void appendTetras(com.jme3.scene.mesh.IndexBuffer tetrahedra) Append tetrahedra to this body. A tetrahedron defines a volume between 4 nodes.- Parameters:
- tetrahedra- a tetrahedron is created for every 4 indices in this buffer (not null, direct, size a multiple of 4)
 
- 
applyForcepublic void applyForce(com.jme3.math.Vector3f force) Apply a force that acts uniformly across the entire body.- Parameters:
- force- the force to add (in physics-space coordinates, not null, unaffected)
 
- 
applyForcepublic void applyForce(com.jme3.math.Vector3f force, int nodeIndex) Apply a force to the indexed node of this body.- Parameters:
- force- the force to add (in physics-space coordinates, not null, unaffected)
- nodeIndex- which node to add it to (≥0, <numNodes)
 
- 
applyRotationpublic void applyRotation(com.jme3.math.Quaternion rotation) Rotate this body.- Parameters:
- rotation- the rotation to apply (not null, unaffected)
 
- 
applyScalepublic void applyScale(com.jme3.math.Vector3f factors) Scale this body.- Parameters:
- factors- the scale factor to apply to each axis (not null, unaffected)
 
- 
applyTransformpublic void applyTransform(com.jme3.math.Transform transform) Transform this body.- Parameters:
- transform- the transform to apply (not null, unaffected)
 
- 
applyTranslationpublic void applyTranslation(com.jme3.math.Vector3f offset) Translate this body.- Parameters:
- offset- the translation to apply to each axis (not null, unaffected)
 
- 
clusterCenterpublic com.jme3.math.Vector3f clusterCenter(int clusterIndex, com.jme3.math.Vector3f storeResult) Copy the center location of the indexed cluster.- Parameters:
- clusterIndex- which cluster (≥0, <numClusters)
- storeResult- storage for the result (modified if not null)
- Returns:
- a location vector (in physics-space coordinates, either storeResult or a new vector)
 
- 
copyClusterCentersCopy the center-of-mass locations of all clusters in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 3 floats per cluster (in physics-space coordinates, either storeResult or a new buffer)
 
- 
copyClusterMassesCopy the masses of all clusters in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing a float value per cluster (either storeResult or a new buffer)
 
- 
copyClusterVelocitiesCopy the (linear) velocities of all clusters in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 3 floats per cluster (in physics-space coordinates, either storeResult or a new buffer)
 
- 
copyFacesCopy the node indices of all faces in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 3 indices per face (either storeResult or a new buffer)
 
- 
copyLinksCopy the node indices of all links in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 2 indices per link (either storeResult or a new buffer)
 
- 
copyLocationsCopy the locations of all nodes in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 3 floats per node (in physics-space coordinates, either storeResult or a new buffer)
 
- 
copyMassesCopy the masses of all nodes in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing a float value per node (either storeResult or a new buffer)
 
- 
copyNormalsCopy the normal vectors of all nodes in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 3 floats per node (in physics-space coordinates, either storeResult or a new buffer)
 
- 
copyTetrasCopy the node indices of all tetrahedra in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 4 indices per tetrahedron (either storeResult or a new buffer)
 
- 
copyVelocitiesCopy the (linear) velocities of all nodes in this body.- Parameters:
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing 3 floats per node (in physics-space coordinates, either storeResult or a new buffer)
 
- 
countClusterspublic final int countClusters()Count the clusters in this body.- Returns:
- the number of clusters (≥0)
 
- 
countFacespublic final int countFaces()Count the faces in this body.- Returns:
- the number of faces (≥0)
 
- 
countLinkspublic final int countLinks()Count the links in this body.- Returns:
- the number of links (≥0)
 
- 
countNodespublic final int countNodes()Count the nodes in this body.- Returns:
- the number of nodes (≥0)
 
- 
countNodesInClusterpublic int countNodesInCluster(int clusterIndex) Count the nodes in the indexed cluster.- Parameters:
- clusterIndex- which cluster (≥0, <numClusters)
- Returns:
- the number of nodes (≥0)
 
- 
countPinnedNodespublic final int countPinnedNodes()Count the pinned nodes in this body.- Returns:
- the number of pinned nodes (≥0)
 
- 
countTetraspublic final int countTetras()Count the tetrahedra in this body.- Returns:
- the number of tetrahedra (≥0)
 
- 
cutLinkpublic boolean cutLink(int nodeIndex0, int nodeIndex1, float cutLocation) Cut a pre-existing link in this body. TODO clarify the semantics- Parameters:
- nodeIndex0- the index of a node in the link (≥0,<numNodes)
- nodeIndex1- the index of the other node in the link (≥0,<numNodes)
- cutLocation- where to cut the link
- Returns:
- true if successful, otherwise false
 
- 
generateBendingConstraintsGenerate bending constraints based on hops in the adjacency graph. This may increase the number of links.- Parameters:
- numHops- (in links, ≥2)
- material- the material for appending links (not null)
 
- 
generateClusterspublic void generateClusters()Generate one cluster per tetrahedron (or one per face if there are no tetrahedra). Any pre-existing clusters are released.
- 
generateClusterspublic void generateClusters(int k, int maxIterations) Generate clusters (K-mean). Any pre-existing clusters are released.- Parameters:
- k- (≥1, <numNodes)
- maxIterations- the maximum number of iterations (>0, default=8192)
 
- 
getRead the specified parameter of the indexed cluster.- Parameters:
- parameter- which parameter to read (not null)
- clusterIndex- which cluster (≥0, <numClusters)
- Returns:
- the coefficient value
 
- 
getSoftConfigAccess the SoftBodyConfig of this body.- Returns:
- the pre-existing instance (not null)
 
- 
getSoftMaterialAccess the Material of this body.- Returns:
- the instance associated with this body (not null)
 
- 
getWorldInfoAccess the world info.- Returns:
- the pre-existing instance (not null)
 
- 
isCollisionAllowedpublic boolean isCollisionAllowed(long pcoId) Test whether collisions are allowed between this body and the identified collision object. Disallowed collisions may result from anchors.- Parameters:
- pcoId- the native ID of the other collision object (not zero)
- Returns:
- true if allowed, otherwise false
 
- 
isEmptypublic final boolean isEmpty()Test whether this body is empty.- Returns:
- true if empty, otherwise false
 
- 
isWorldInfoProtectedpublic boolean isWorldInfoProtected()Test whether this body's world info should be replaced when added to a space.- Returns:
- false if the info should be replaced, true if it should be preserved
 
- 
listNodesInClusterList all nodes in the indexed cluster.- Parameters:
- clusterIndex- which cluster (≥0, <numClusters)
- storeResult- storage for the result (direct, modified) or null
- Returns:
- a direct buffer containing node indices (either storeResult or a new buffer)
 
- 
marginpublic float margin()Read the collision margin of this body.- Returns:
- the margin distance (in physics-space units, >0)
 
- 
nodeLocationpublic com.jme3.math.Vector3f nodeLocation(int nodeIndex, com.jme3.math.Vector3f storeResult) Copy the location of the indexed node.- Parameters:
- nodeIndex- which node (≥0, <numNodes)
- storeResult- storage for the result (modified if not null)
- Returns:
- a location vector (in physics-space coordinates, either storeResult or a new vector)
 
- 
nodeMasspublic float nodeMass(int nodeIndex) Read the mass of the indexed node.- Parameters:
- nodeIndex- which node to read (≥0, <numNodes)
- Returns:
- the mass of the node (≥0)
 
- 
nodeNormalpublic com.jme3.math.Vector3f nodeNormal(int nodeIndex, com.jme3.math.Vector3f storeResult) Copy the normal vector of the indexed node.- Parameters:
- nodeIndex- which node (≥0, <numNodes)
- storeResult- storage for the result (modified if not null)
- Returns:
- a normal vector (in physics-space coordinates, either storeResult or a new vector)
 
- 
nodeVelocitypublic com.jme3.math.Vector3f nodeVelocity(int nodeIndex, com.jme3.math.Vector3f storeResult) Copy the velocity of the indexed node.- Parameters:
- nodeIndex- which node (≥0, <numNodes)
- storeResult- storage for the result (modified if not null)
- Returns:
- a velocity vector (in physics-space coordinates, either storeResult or a new vector)
 
- 
randomizeConstraintspublic void randomizeConstraints()Randomize constraints to reduce solver bias.
- 
releaseAllClusterspublic void releaseAllClusters()Release all clusters.
- 
releaseClusterpublic void releaseCluster(int clusterIndex) Release the indexed cluster.- Parameters:
- clusterIndex- which cluster to release (≥0, <numClusters)
 
- 
resetRestingLengthspublic void resetRestingLengths()Set the resting lengths of all links to their current lengths.
- 
restingLengthsScalepublic float restingLengthsScale()Read the scale factor for resting lengths.- Returns:
- the scale factor
 
- 
setAlter the specified parameter of the indexed cluster.- Parameters:
- parameter- which parameter to alter (not null)
- clusterIndex- which cluster (≥0, <numClusters)
- value- the desired value
 
- 
setMarginpublic final void setMargin(float margin) Alter the collision margin of this body.- Parameters:
- margin- the desired margin distance (in physics-space units, >0)
 
- 
setMassByAreapublic void setMassByArea(float totalMass) Alter the total mass for this body, distributing it based on the area of each face.- Parameters:
- totalMass- the desired total mass (>0)
 
- 
setMassByCurrentpublic void setMassByCurrent(float totalMass) Alter the total mass for this body, distributing it to nodes in proportion to their current masses.- Parameters:
- totalMass- the desired total mass (>0, default=numNodes)
 
- 
setMassesAlter the masses of all nodes.- Parameters:
- masses- a direct buffer containing the desired masses (not null, all elements ≥0)
 
- 
setMassFromDensitypublic void setMassFromDensity(float density) Alter the total mass of this body, weighted by volume.- Parameters:
- density- the desired density (>0)
 
- 
setNodeMasspublic void setNodeMass(int nodeIndex, float mass) Alter the mass of the indexed node.- Parameters:
- nodeIndex- which node to modify (≥0, <numNodes)
- mass- the desired mass (≥0, default=1)
 
- 
setNodeVelocitypublic void setNodeVelocity(int nodeIndex, com.jme3.math.Vector3f velocity) Alter the velocity of the indexed node.- Parameters:
- nodeIndex- which node to modify (≥0, <numNodes)
- velocity- the desired velocity vector (not null, unaffected)
 
- 
setNormalsAlter the normal vectors of all nodes.- Parameters:
- normals- a direct buffer containing the desired normals (in physics-space coordinates, not null, unaffected)
 
- 
setPhysicsLocationDppublic void setPhysicsLocationDp(com.simsilica.mathd.Vec3d location) Directly relocate the center of this body's bounding box.- Parameters:
- location- the desired location (in physics-space coordinates, not null, unaffected)
 
- 
setPosepublic void setPose(boolean setVolumePose, boolean setFramePose) Set the "default pose" (lowest energy state) of this body based on its current pose.- Parameters:
- setVolumePose- true→alter the volume pose, false→ don't alter it
- setFramePose- true→alter the frame pose, false→ don't alter it
 
- 
setProtectWorldInfopublic void setProtectWorldInfo(boolean newState) Alter whether this body's world info should be replaced when the body gets added to a space.- Parameters:
- newState- true to preserve the world info, false to allow it to be replaced (default=false)
 
- 
setRestingLengthScalepublic void setRestingLengthScale(float scale) Alter the scale factor for resting lengths.- Parameters:
- scale- the desired scale factor
 
- 
setVelocitiesAlter the velocities of all nodes.- Parameters:
- velocities- a direct buffer containing the desired velocities (in physics-space coordinates, not null, unaffected)
 
- 
setVelocitypublic void setVelocity(com.jme3.math.Vector3f velocity) Alter the velocities of all nodes to make them identical.- Parameters:
- velocity- the desired velocity vector (in physics-space coordinates, not null, unaffected)
 
- 
setVolumeDensitypublic void setVolumeDensity(float density) Set volume density (using tetrahedra) TODO clarify semantics- Parameters:
- density- the desired density
 
- 
setVolumeMasspublic void setVolumeMass(float mass) Set volume mass (using tetrahedra) TODO clarify semantics- Parameters:
- mass- the desired mass
 
- 
setWindVelocitypublic void setWindVelocity(com.jme3.math.Vector3f velocity) Alter the wind velocity.- Parameters:
- velocity- the desired velocity vector (in physics-space coordinates, not null, unaffected)
 
- 
setWorldInfoReplace the world info of this body.Invoke this method after adding the body to a space. Adding a body to a space may replace its world info. - Parameters:
- worldInfo- the desired SoftBodyWorldInfo (not null, alias created)
 
- 
volumepublic float volume()Calculate the volume of this body.- Returns:
- the total volume (in cubic physics-space units, ≥0)
 
- 
windVelocitypublic com.jme3.math.Vector3f windVelocity(com.jme3.math.Vector3f storeResult) Copy the wind velocity.- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- a velocity vector (in physics-space coordinates, either storeResult or a new vector)
 
- 
destroySoftBodyprotected void destroySoftBody()Destroy the pre-existing btSoftBody (if any) except for its worldInfo.
- 
initDefaultprotected void initDefault()Reinitialize the btSoftBody to the default values.
- 
newEmptySoftBodyprotected void newEmptySoftBody()Create an emptybtSoftBodyfor this PhysicsSoftBody, using the pre-existing worldInfo. The pre-existing btSoftBody (if any) will be destroyed.
- 
boundingBoxpublic com.jme3.bounding.BoundingBox boundingBox(com.jme3.bounding.BoundingBox storeResult) Calculate the axis-aligned bounding box for this body.- Overrides:
- boundingBoxin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- a bounding box (in physics-space coordinates, either storeResult or a new instance)
 
- 
cloneFieldsCallback fromClonerto convert this shallow-cloned body into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
- cloneFieldsin interface- com.jme3.util.clone.JmeCloneable
- Overrides:
- cloneFieldsin class- PhysicsBody
- Parameters:
- cloner- the Cloner that's cloning this body (not null)
- original- the instance from which this body was shallow-cloned (not null, unaffected)
 
- 
getGravitypublic com.jme3.math.Vector3f getGravity(com.jme3.math.Vector3f storeResult) Copy this body's gravitational acceleration.- Specified by:
- getGravityin class- PhysicsBody
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- an acceleration vector (in physics-space coordinates, either storeResult or a new vector, not null)
 
- 
getMasspublic float getMass()Determine the total mass of this body.- Specified by:
- getMassin class- PhysicsBody
- Returns:
- the total mass (≥0)
 
- 
getPhysicsLocationpublic com.jme3.math.Vector3f getPhysicsLocation(com.jme3.math.Vector3f storeResult) Locate the center of this body's axis-aligned bounding box.- Overrides:
- getPhysicsLocationin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- a location vector (in physics-space coordinates, either storeResult or a new instance, not null)
 
- 
getPhysicsLocationDppublic com.simsilica.mathd.Vec3d getPhysicsLocationDp(com.simsilica.mathd.Vec3d storeResult) Locate the center of this body's axis-aligned bounding box.- Overrides:
- getPhysicsLocationDpin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- a location vector (in physics-space coordinates, either storeResult or a new instance, not null, finite)
 
- 
getPhysicsRotationpublic com.jme3.math.Quaternion getPhysicsRotation(com.jme3.math.Quaternion storeResult) Copy the orientation (rotation) of this body to a Quaternion.- Overrides:
- getPhysicsRotationin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- an identity quaternion (either storeResult or a new instance, not null)
 
- 
getPhysicsRotationDppublic com.simsilica.mathd.Quatd getPhysicsRotationDp(com.simsilica.mathd.Quatd storeResult) Copy the orientation (rotation) of this body to a Quatd.- Overrides:
- getPhysicsRotationDpin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- an identity quaternion (either storeResult or a new instance, not null)
 
- 
getPhysicsRotationMatrixpublic com.jme3.math.Matrix3f getPhysicsRotationMatrix(com.jme3.math.Matrix3f storeResult) Copy the orientation of this body (the basis of its local coordinate system) to a Matrix3f.- Overrides:
- getPhysicsRotationMatrixin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- an identity matrix (either storeResult or a new instance, not null)
 
- 
getPhysicsRotationMatrixDppublic com.simsilica.mathd.Matrix3d getPhysicsRotationMatrixDp(com.simsilica.mathd.Matrix3d storeResult) Copy the orientation of this body (the basis of its local coordinate system) to a Matrix3d.- Overrides:
- getPhysicsRotationMatrixDpin class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- an identity matrix (either storeResult or a new instance, not null)
 
- 
getScalepublic com.jme3.math.Vector3f getScale(com.jme3.math.Vector3f storeResult) Copy the scale factors of this object.- Overrides:
- getScalein class- PhysicsCollisionObject
- Parameters:
- storeResult- storage for the result (modified if not null)
- Returns:
- the value (1,1,1) (either storeResult or a new vector)
 
- 
readDe-serialize this body from the specified importer, for example when loading from a J3O file.- Specified by:
- readin interface- com.jme3.export.Savable
- Overrides:
- readin class- PhysicsCollisionObject
- Parameters:
- importer- (not null)
- Throws:
- IOException- from the importer
 
- 
setDebugMeshNormalspublic void setDebugMeshNormals(jme3utilities.MeshNormals newSetting) Alter which normals to include in new debug meshes.- Overrides:
- setDebugMeshNormalsin class- PhysicsCollisionObject
- Parameters:
- newSetting- an enum value (either None or Smooth)
 
- 
setGravitypublic void setGravity(com.jme3.math.Vector3f acceleration) Alter this body's gravitational acceleration.Invoke this method after adding the body to a space. Adding a body to a space may override its gravity. - Specified by:
- setGravityin class- PhysicsBody
- Parameters:
- acceleration- the desired acceleration vector (in physics-space coordinates, not null, unaffected)
 
- 
setMasspublic void setMass(float totalMass) Alter the total mass for this body, distributing it in proportion to the current mass of each node.- Specified by:
- setMassin class- PhysicsBody
- Parameters:
- totalMass- the desired total mass (>0, default=numNodes)
 
- 
setPhysicsLocationpublic void setPhysicsLocation(com.jme3.math.Vector3f location) Directly relocate the center of this body's bounding box.- Specified by:
- setPhysicsLocationin class- PhysicsBody
- Parameters:
- location- the desired location (in physics-space coordinates, not null, finite, unaffected)
 
- 
writeSerialize this body to the specified exporter, for example when saving to a J3O file.- Specified by:
- writein interface- com.jme3.export.Savable
- Overrides:
- writein class- PhysicsCollisionObject
- Parameters:
- exporter- (not null)
- Throws:
- IOException- from the exporter
 
 
-