Package com.github.stephengold.joltjni
Class SoftBodyCreationSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.SoftBodyCreationSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstSoftBodyCreationSettings,AutoCloseable,Comparable<JoltPhysicsObject>
public class SoftBodyCreationSettings
extends JoltPhysicsObject
implements ConstSoftBodyCreationSettings
Settings used to create a soft body.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate default settings.Instantiate a copy of the specified settings.SoftBodyCreationSettings(ConstSoftBodySharedSettings settings, RVec3Arg location, QuatArg orientation, int objectLayer) Instantiate settings for the specified shared settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest whether the created body will be allowed to fall asleep.Access the collision group.booleanTest whether faces will be double-sided.floatReturn the friction ratio.floatReturn the gravity factor.floatReturn the linear damping constant.booleanTest whether to bake rotation into the vertices and set the body rotation to identity.floatReturn the maximum linear speed.intReturn the number of solver iterations.intReturn the index of the object layer.Copy the (initial) location.floatReturn the internal pressure.floatReturn the restitution ratio.Copy the (initial) orientation of the body's axes.Access the shared settings.booleanTest whether to update the position of the body during simulation.longReturn the user data.floatReturn the radius of each particle.voidrestoreBinaryState(StreamIn stream) Read the state of this object from the specified stream, excluding the shape and group filter.voidsaveBinaryState(StreamOut stream) Write the state of this object to the specified stream, excluding the shared settings, materials, and group filter.voidsaveWithChildren(StreamOut stream, SharedSettingsToIdMap sbssMap, MaterialToIdMap materialMap, GroupFilterToIdMap filterMap) Write the state of this object to the specified stream.setAllowSleeping(boolean allow) Alter whether the created body will be allowed to fall asleep.Alter the collision group to which the body will belong.setFacesDoubleSided(boolean enable) Alter whether faces will be double-sided.setFriction(float friction) Alter the friction ratio.setGravityFactor(float factor) Alter the gravity multiplier.setLinearDamping(float damping) Alter the linear damping constant.setMakeRotationIdentity(boolean enable) Alter whether to bake the specified rotation into the vertices and set the body rotation to identity.setMaxLinearVelocity(float maxSpeed) Alter the maximum speed of vertices.setNumIterations(int numIterations) Alter the number of solver iterations.setObjectLayer(int objLayer) Alter the object layer.setPosition(double xx, double yy, double zz) Alter the (initial) location of the body's origin.setPosition(RVec3Arg location) Alter the (initial) location of the body's origin.setPressure(float pressure) Alter the internal pressure.setRestitution(float restitution) Alter the restitution ratio for collisions.setRotation(QuatArg orientation) Alter the (initial) orientation.setSettings(ConstSoftBodySharedSettings sharedSettings) Replace the shared settings.setUpdatePosition(boolean enable) Alter whether to update the position of the body during simulation.setUserData(long value) Alter the user data.setVertexRadius(float radius) Alter the size of every particle.static SbcsResultsRestoreWithChildren(StreamIn stream, IdToSharedSettingsMap settingsMap, IdToMaterialMap materialMap, IdToGroupFilterMap filterMap) Read a settings object from the specified binary stream.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
SoftBodyCreationSettings
public SoftBodyCreationSettings()Instantiate default settings. -
SoftBodyCreationSettings
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
Method Details
-
restoreBinaryState
Read the state of this object from the specified stream, excluding the shape and group filter.- Parameters:
stream- where to read objects from (not null)
-
setAllowSleeping
Alter whether the created body will be allowed to fall asleep. (native member: mAllowSleeping)- Parameters:
allow-trueto allow,falseto inhibit (default=true)- Returns:
- the modified settings, for chaining
-
setCollisionGroup
Alter the collision group to which the body will belong. (native member: mCollisionGroup)- Parameters:
group- the desired group (not null, unaffected)- Returns:
- the modified settings, for chaining
-
setFacesDoubleSided
Alter whether faces will be double-sided. (native member: mFacesDoubleSided)- Parameters:
enable-truefor double-sided,falsefor single-sided (default=false)- Returns:
- the modified settings, for chaining
-
setFriction
Alter the friction ratio. (native member: mFriction)- Parameters:
friction- the desired ratio (typically ≥0 and ≤1, default=0.2)- Returns:
- the modified settings, for chaining
-
setGravityFactor
Alter the gravity multiplier. (native member: mGravityFactor)- Parameters:
factor- the desired multiplier (default=1)- Returns:
- the modified settings, for chaining
-
setLinearDamping
Alter the linear damping constant. (native member: mLinearDamping)- Parameters:
damping- the desired value (in units of 1 per second, ≥0, ≤1, default=0.1)- Returns:
- the modified settings, for chaining
-
setMakeRotationIdentity
Alter whether to bake the specified rotation into the vertices and set the body rotation to identity. (native member: mMakeRotationIdentity)- Parameters:
enable-trueto bake and set rotation, orfalseto skip that step (default=true)- Returns:
- the modified settings, for chaining
-
setMaxLinearVelocity
Alter the maximum speed of vertices. (native member: mMaxSpeed)- Parameters:
maxSpeed- the desired maximum speed (in meters per second, ≥0, default=500)- Returns:
- the modified settings, for chaining
-
setNumIterations
Alter the number of solver iterations. (native member: mNumIterations)- Parameters:
numIterations- the desired number of iterations (default=5)- Returns:
- the modified settings, for chaining
-
setObjectLayer
Alter the object layer. (native member: mObjectLayer)- Parameters:
objLayer- the index of the desired object layer (≥0, <numObjectLayers, <65536, default=0)- Returns:
- the modified settings, for chaining
-
setPosition
Alter the (initial) location of the body's origin. (native member: mPosition)- Parameters:
xx- the desired X coordinate (in system coordinates, default=0)yy- the desired Y coordinate (in system coordinates, default=0)zz- the desired Z coordinate (in system coordinates, default=0)- Returns:
- the modified settings, for chaining
-
setPosition
Alter the (initial) location of the body's origin. (native member: mPosition)- Parameters:
location- the desired location (in system coordinates, not null, unaffected, default=(0,0,0))- Returns:
- the modified settings, for chaining
-
setPressure
Alter the internal pressure. (native member: mPressure)- Parameters:
pressure- the desired pressure (default=0)- Returns:
- the modified settings, for chaining
-
setRestitution
Alter the restitution ratio for collisions. (native member: mRestitution)- Parameters:
restitution- the desired ratio (typically ≥0 and ≤1, default=0)- Returns:
- the modified settings, for chaining
-
setRotation
Alter the (initial) orientation. (native member: mRotation)- Parameters:
orientation- the desired location (relative to system axes, not null, unaffected, default=(0,0,0,1))- Returns:
- the modified settings, for chaining
-
setUpdatePosition
Alter whether to update the position of the body during simulation. (native member: mUpdatePosition)- Parameters:
enable-trueto update the position, orfalseto skip updating (default=true)- Returns:
- the modified settings, for chaining
-
setUserData
Alter the user data. (native member: mUserData)- Parameters:
value- the desired value (default=0)- Returns:
- the modified settings, for chaining
-
setVertexRadius
Alter the size of every particle.- Parameters:
radius- the desired radius (≥0, default=0)- Returns:
- the modified settings, for chaining
-
getAllowSleeping
public boolean getAllowSleeping()Test whether the created body will be allowed to fall asleep. The settings are unaffected. (native member: mAllowSleeping)- Specified by:
getAllowSleepingin interfaceConstSoftBodyCreationSettings- Returns:
trueif allowed, otherwisefalse
-
getCollisionGroup
Access the collision group. (native member: mCollisionFriction)- Specified by:
getCollisionGroupin interfaceConstSoftBodyCreationSettings- Returns:
- a new JVM object with the pre-existing native object assigned
-
getFacesDoubleSided
public boolean getFacesDoubleSided()Test whether faces will be double-sided. The settings are unaffected. (native member: mFacesDoubleSided)- Specified by:
getFacesDoubleSidedin interfaceConstSoftBodyCreationSettings- Returns:
trueif double-sided, otherwisefalse
-
getFriction
public float getFriction()Return the friction ratio. The settings are unaffected. (native member: mFriction)- Specified by:
getFrictionin interfaceConstSoftBodyCreationSettings- Returns:
- the ratio (typically ≥0 and ≤1)
-
getGravityFactor
public float getGravityFactor()Return the gravity factor. The settings are unaffected. (native member: mGravityFactor)- Specified by:
getGravityFactorin interfaceConstSoftBodyCreationSettings- Returns:
- the factor
-
getLinearDamping
public float getLinearDamping()Return the linear damping constant. The settings are unaffected. (native member: mLinearDamping)- Specified by:
getLinearDampingin interfaceConstSoftBodyCreationSettings- Returns:
- the constant (in units of per second, ≥0, ≤1)
-
getMakeRotationIdentity
public boolean getMakeRotationIdentity()Test whether to bake rotation into the vertices and set the body rotation to identity. The settings are unaffected. (native member: mMakeRotationIdentity)- Specified by:
getMakeRotationIdentityin interfaceConstSoftBodyCreationSettings- Returns:
trueif rotation will be baked in, otherwisefalse
-
getMaxLinearVelocity
public float getMaxLinearVelocity()Return the maximum linear speed. The settings are unaffected. (native member: mMaxSpeed)- Specified by:
getMaxLinearVelocityin interfaceConstSoftBodyCreationSettings- Returns:
- the maximum speed (in meters per second)
-
getNumIterations
public int getNumIterations()Return the number of solver iterations. The settings are unaffected. (native member: mNumIterations)- Specified by:
getNumIterationsin interfaceConstSoftBodyCreationSettings- Returns:
- the number of iterations
-
getObjectLayer
public int getObjectLayer()Return the index of the object layer. The settings are unaffected. (native member: mObjectLayer)- Specified by:
getObjectLayerin interfaceConstSoftBodyCreationSettings- Returns:
- the layer index (≥0, <numObjectLayers)
-
getPosition
Copy the (initial) location. The settings are unaffected. (native member: mPosition)- Specified by:
getPositionin interfaceConstSoftBodyCreationSettings- Returns:
- a new location vector (in system coordinates, all components finite)
-
getPressure
public float getPressure()Return the internal pressure. The settings are unaffected. (native member: mPressure)- Specified by:
getPressurein interfaceConstSoftBodyCreationSettings- Returns:
- the pressure
-
getRestitution
public float getRestitution()Return the restitution ratio. The settings are unaffected. (native member: mRestitution)- Specified by:
getRestitutionin interfaceConstSoftBodyCreationSettings- Returns:
- the ratio (typically ≥0 and ≤1)
-
getRotation
Copy the (initial) orientation of the body's axes. The settings are unaffected. (native member: mRotation)- Specified by:
getRotationin interfaceConstSoftBodyCreationSettings- Returns:
- a new rotation quaternion (relative to the system axes)
-
getSettings
Access the shared settings. (native member: mSettings)- Specified by:
getSettingsin interfaceConstSoftBodyCreationSettings- Returns:
- a new JVM object with the pre-existing native object assigned, or
nullif none
-
getUpdatePosition
public boolean getUpdatePosition()Test whether to update the position of the body during simulation. The settings are unaffected. (native member: mUpdatePosition)- Specified by:
getUpdatePositionin interfaceConstSoftBodyCreationSettings- Returns:
trueif the position will be updated, otherwisefalse
-
getUserData
public long getUserData()Return the user data. The settings are unaffected. (native member: mUserData)- Specified by:
getUserDatain interfaceConstSoftBodyCreationSettings- Returns:
- the value
-
getVertexRadius
public float getVertexRadius()Return the radius of each particle. The settings are unaffected. (native attribute: mVertexRadius)- Specified by:
getVertexRadiusin interfaceConstSoftBodyCreationSettings- Returns:
- the radius (in meters)
-
saveBinaryState
Write the state of this object to the specified stream, excluding the shared settings, materials, and group filter. The settings are unaffected.- Specified by:
saveBinaryStatein interfaceConstSoftBodyCreationSettings- Parameters:
stream- where to write objects (not null)
-