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.SoftBodyCreationSettings
(ConstSoftBodySharedSettings settings, RVec3Arg location, QuatArg orientation, int objectLayer) Instantiate settings for the specified shared settings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Test whether the created body will be allowed to fall asleep.Access the collision group.float
Return the friction ratio.float
Return the gravity factor.float
Return the linear damping constant.boolean
Test whether to bake rotation into the vertices and set the body rotation to identity.float
Return the maximum linear speed.int
Return the number of solver iterations.int
Return the index of the object layer.Copy the (initial) location.float
Return the pressure.float
Return the restitution ratio.Copy the (initial) orientation of the body's axes.Access the shared settings.boolean
Test whether to update the position of the body during simulation.long
Return the user data.setAllowSleeping
(boolean allow) Alter whether the created body will be allowed to fall asleep.Alter the collision group to which the body will belong.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
(RVec3Arg location) Alter the (initial) location of the body's origin.setPressure
(float pressure) Alter the 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.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
SoftBodyCreationSettings
public SoftBodyCreationSettings()Instantiate default settings.
-
-
Method Details
-
setAllowSleeping
Alter whether the created body will be allowed to fall asleep. (native member: mAllowSleeping)- Parameters:
allow
-true
to allow,false
to 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
-
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
-true
to bake and set rotation, orfalse
to 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:
location
- the desired location (in system coordinates, not null, unaffected, default=(0,0,0))- Returns:
- the modified settings, for chaining
-
setPressure
Alter the 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
-true
to update the position, orfalse
to 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
-
getAllowSleeping
public boolean getAllowSleeping()Test whether the created body will be allowed to fall asleep. The settings are unaffected. (native member: mAllowSleeping)- Specified by:
getAllowSleeping
in interfaceConstSoftBodyCreationSettings
- Returns:
true
if allowed, otherwisefalse
-
getCollisionGroup
Access the collision group. (native member: mCollisionFriction)- Specified by:
getCollisionGroup
in interfaceConstSoftBodyCreationSettings
- Returns:
- a new JVM object with the pre-existing native object assigned
-
getFriction
public float getFriction()Return the friction ratio. The settings are unaffected. (native member: mFriction)- Specified by:
getFriction
in 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:
getGravityFactor
in interfaceConstSoftBodyCreationSettings
- Returns:
- the factor
-
getLinearDamping
public float getLinearDamping()Return the linear damping constant. The settings are unaffected. (native member: mLinearDamping)- Specified by:
getLinearDamping
in 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:
getMakeRotationIdentity
in interfaceConstSoftBodyCreationSettings
- Returns:
true
if rotation will be baked in, otherwisefalse
-
getMaxLinearVelocity
public float getMaxLinearVelocity()Return the maximum linear speed. The settings are unaffected. (native member: mMaxSpeed)- Specified by:
getMaxLinearVelocity
in 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:
getNumIterations
in 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:
getObjectLayer
in interfaceConstSoftBodyCreationSettings
- Returns:
- the layer index (≥0, <numObjectLayers)
-
getPosition
Copy the (initial) location. The settings are unaffected. (native member: mPosition)- Specified by:
getPosition
in interfaceConstSoftBodyCreationSettings
- Returns:
- a new location vector (in system coordinates, all components finite)
-
getPressure
public float getPressure()Return the pressure. The settings are unaffected. (native member: mPressure)- Specified by:
getPressure
in interfaceConstSoftBodyCreationSettings
- Returns:
- the pressure
-
getRestitution
public float getRestitution()Return the restitution ratio. The settings are unaffected. (native member: mRestitution)- Specified by:
getRestitution
in 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:
getRotation
in interfaceConstSoftBodyCreationSettings
- Returns:
- a new rotation quaternion (relative to the system axes)
-
getSettings
Access the shared settings. (native member: mSettings)- Specified by:
getSettings
in interfaceConstSoftBodyCreationSettings
- Returns:
- a new JVM object with the pre-existing native object assigned, or
null
if 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:
getUpdatePosition
in interfaceConstSoftBodyCreationSettings
- Returns:
true
if the position will be updated, otherwisefalse
-
getUserData
public long getUserData()Return the user data. The settings are unaffected. (native member: mUserData)- Specified by:
getUserData
in interfaceConstSoftBodyCreationSettings
- Returns:
- the value
-