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 Details

    • SoftBodyCreationSettings

      public SoftBodyCreationSettings()
      Instantiate default settings.
    • SoftBodyCreationSettings

      public SoftBodyCreationSettings(ConstSoftBodySharedSettings settings, RVec3Arg location, QuatArg orientation, int objectLayer)
      Instantiate settings for the specified shared settings.
      Parameters:
      settings - the shared settings to use (not null, unaffected)
      location - the desired initial location (in system coordinates, not null, unaffected)
      orientation - the desired initial orientation (relative to system axes, not null, unaffected)
      objectLayer - the desired object layer (≥0)
  • Method Details

    • setAllowSleeping

      public SoftBodyCreationSettings setAllowSleeping(boolean allow)
      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

      public SoftBodyCreationSettings setCollisionGroup(ConstCollisionGroup group)
      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

      public SoftBodyCreationSettings setFriction(float friction)
      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

      public SoftBodyCreationSettings setGravityFactor(float factor)
      Alter the gravity multiplier. (native member: mGravityFactor)
      Parameters:
      factor - the desired multiplier (default=1)
      Returns:
      the modified settings, for chaining
    • setLinearDamping

      public SoftBodyCreationSettings setLinearDamping(float damping)
      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

      public SoftBodyCreationSettings setMakeRotationIdentity(boolean enable)
      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, or false to skip that step (default=true)
      Returns:
      the modified settings, for chaining
    • setMaxLinearVelocity

      public SoftBodyCreationSettings setMaxLinearVelocity(float maxSpeed)
      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

      public SoftBodyCreationSettings setNumIterations(int numIterations)
      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

      public SoftBodyCreationSettings setObjectLayer(int objLayer)
      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

      public SoftBodyCreationSettings setPosition(RVec3Arg location)
      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

      public SoftBodyCreationSettings setPressure(float pressure)
      Alter the pressure. (native member: mPressure)
      Parameters:
      pressure - the desired pressure (default=0)
      Returns:
      the modified settings, for chaining
    • setRestitution

      public SoftBodyCreationSettings setRestitution(float restitution)
      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

      public SoftBodyCreationSettings setRotation(QuatArg orientation)
      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
    • setSettings

      public SoftBodyCreationSettings setSettings(ConstSoftBodySharedSettings sharedSettings)
      Replace the shared settings. (native member: mSettings)
      Parameters:
      sharedSettings - the desired settings (not null, alias created)
      Returns:
      the modified settings, for chaining
    • setUpdatePosition

      public SoftBodyCreationSettings setUpdatePosition(boolean enable)
      Alter whether to update the position of the body during simulation. (native member: mUpdatePosition)
      Parameters:
      enable - true to update the position, or false to skip updating (default=true)
      Returns:
      the modified settings, for chaining
    • setUserData

      public SoftBodyCreationSettings setUserData(long value)
      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 interface ConstSoftBodyCreationSettings
      Returns:
      true if allowed, otherwise false
    • getCollisionGroup

      public CollisionGroup getCollisionGroup()
      Access the collision group. (native member: mCollisionFriction)
      Specified by:
      getCollisionGroup in interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      Returns:
      the factor
    • getLinearDamping

      public float getLinearDamping()
      Return the linear damping constant. The settings are unaffected. (native member: mLinearDamping)
      Specified by:
      getLinearDamping in interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      Returns:
      true if rotation will be baked in, otherwise false
    • getMaxLinearVelocity

      public float getMaxLinearVelocity()
      Return the maximum linear speed. The settings are unaffected. (native member: mMaxSpeed)
      Specified by:
      getMaxLinearVelocity in interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      Returns:
      the layer index (≥0, <numObjectLayers)
    • getPosition

      public RVec3 getPosition()
      Copy the (initial) location. The settings are unaffected. (native member: mPosition)
      Specified by:
      getPosition in interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      Returns:
      the pressure
    • getRestitution

      public float getRestitution()
      Return the restitution ratio. The settings are unaffected. (native member: mRestitution)
      Specified by:
      getRestitution in interface ConstSoftBodyCreationSettings
      Returns:
      the ratio (typically ≥0 and ≤1)
    • getRotation

      public Quat getRotation()
      Copy the (initial) orientation of the body's axes. The settings are unaffected. (native member: mRotation)
      Specified by:
      getRotation in interface ConstSoftBodyCreationSettings
      Returns:
      a new rotation quaternion (relative to the system axes)
    • getSettings

      public ConstSoftBodySharedSettings getSettings()
      Access the shared settings. (native member: mSettings)
      Specified by:
      getSettings in interface ConstSoftBodyCreationSettings
      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 interface ConstSoftBodyCreationSettings
      Returns:
      true if the position will be updated, otherwise false
    • getUserData

      public long getUserData()
      Return the user data. The settings are unaffected. (native member: mUserData)
      Specified by:
      getUserData in interface ConstSoftBodyCreationSettings
      Returns:
      the value