Class CharacterVirtualSettings

All Implemented Interfaces:
ConstCharacterBaseSettings, ConstCharacterVirtualSettings, ConstJoltPhysicsObject, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>

public class CharacterVirtualSettings extends CharacterBaseSettings implements ConstCharacterVirtualSettings, RefTarget
Settings used to create a CharacterVirtual.
  • Constructor Details

    • CharacterVirtualSettings

      public CharacterVirtualSettings()
      Instantiate default settings.
  • Method Details

    • setBackFaceMode

      public void setBackFaceMode(EBackFaceMode mode)
      Alter whether the character will move through back facing triangles. (native attribute: mBackFaceMode)
      Parameters:
      mode - the desired mode (not null, default=CollideWithBackFaces)
    • setCharacterPadding

      public void setCharacterPadding(float padding)
      Alter how far the character tries to stay away from the geometry. (native attribute: mCharacterPadding)
      Parameters:
      padding - the desired distance (in meters, default=0.02)
    • setCollisionTolerance

      public void setCollisionTolerance(float tolerance)
      Alter the collision tolerance. (native attribute: mCollisionTolerance)
      Parameters:
      tolerance - the desired penetration distance (in meters, default=0.001)
    • setHitReductionCosMaxAngle

      public void setHitReductionCosMaxAngle(int cosine)
      Alter the maximum angle for merging during hit reduction. (native attribute: mHitReductionCosMaxAngle)
      Parameters:
      cosine - the cosine of the maximum angle, or -1 to disable hit reduction (default=0.999)
    • setInnerBodyLayer

      public void setInnerBodyLayer(int objectLayer)
      Alter the object layer that the inner rigid body will be added to. (native attribute: mInnerBodyLayer)
      Parameters:
      objectLayer - the index of the desired object layer (default=0)
    • setInnerBodyShape

      public void setInnerBodyShape(ConstShape shape)
      Replace the shape of the inner rigid body. (native attribute: mInnerBodyShape)
      Parameters:
      shape - the desired shape, or null for no inner body (default=null)
    • setMass

      public void setMass(float mass)
      Alter the character's mass. (native attribute: mMass)
      Parameters:
      mass - the desired mass (in kilograms, default=70)
    • setMaxCollisionIterations

      public void setMaxCollisionIterations(int numIterations)
      Alter the maximum number of collision iterations. (native attribute: mMaxCollisionIterations)
      Parameters:
      numIterations - the desired number of iterations (≥0, default=5)
    • setMaxConstraintIterations

      public void setMaxConstraintIterations(int numIterations)
      Alter how often to try stepping in the constraint solver. (native attribute: mMaxConstraintIterations)
      Parameters:
      numIterations - the desired number of iterations (≥0, default=15)
    • setMaxNumHits

      public void setMaxNumHits(int numHits)
      Alter the maximum number of hits to collect. (native attribute: mMaxNumHits)
      Parameters:
      numHits - the desired limit (≥0), default=256)
    • setMaxStrength

      public void setMaxStrength(float force)
      Alter the maximum force applied to other bodies. (native attribute: mMaxStrength)
      Parameters:
      force - the desired force (in Newtons)
    • setMinTimeRemaining

      public void setMinTimeRemaining(float interval)
      Alter the early out threshold. (native attribute: mMinTimeRemaining)
      Parameters:
      interval - the desired simulation time interval (in seconds, default=0.0001)
    • setPenetrationRecoverySpeed

      public void setPenetrationRecoverySpeed(float fraction)
      Alter how quickly penetration is resolved. (native attribute: mPenetrationRecoverySpeed)
      Parameters:
      fraction - the desired resolution fraction (0=never resolved, 1=all in one update, default=1)
    • setPredictiveContactDistance

      public void setPredictiveContactDistance(float distance)
      Alter the maximum range of predictive contacts. (native attribute: mPredictiveContactDistance)
      Parameters:
      distance - the desired distance (in meters, default=0.1)
    • setShapeOffset

      public void setShapeOffset(Vec3Arg offset)
      Alter the local offset applied to the shape. (native attribute: mShapeOffset)
      Parameters:
      offset - the desired offset (in local coordinates, not null, unaffected, default=(0,0,0))
    • getBackFaceMode

      public EBackFaceMode getBackFaceMode()
      Determine whether the character will move through back-facing triangles. The settings are unaffected. (native attribute: mBackFaceMode)
      Specified by:
      getBackFaceMode in interface ConstCharacterVirtualSettings
      Returns:
      an enum value (not null)
    • getCharacterPadding

      public float getCharacterPadding()
      Return how far the character tries to stay away from the geometry. The settings are unaffected. (native attribute: mCharacterPadding)
      Specified by:
      getCharacterPadding in interface ConstCharacterVirtualSettings
      Returns:
      the desired distance (in meters)
    • getCollisionTolerance

      public float getCollisionTolerance()
      Return the collision tolerance. The settings are unaffected. (native attribute: mCollisionTolerance)
      Specified by:
      getCollisionTolerance in interface ConstCharacterVirtualSettings
      Returns:
      the allowed penetration distance (in meters)
    • getHitReductionCosMaxAngle

      public float getHitReductionCosMaxAngle()
      Return the maximum angle for merging during hit reduction. The settings are unaffected. (native attribute: mHitReductionCosMaxAngle)
      Specified by:
      getHitReductionCosMaxAngle in interface ConstCharacterVirtualSettings
      Returns:
      the cosine of the maximum angle, or -1 if hit reduction is disabled
    • getInnerBodyLayer

      public int getInnerBodyLayer()
      Return the object layer that the inner rigid body will be added to. The settings are unaffected. (native attribute: mInnerBodyLayer)
      Specified by:
      getInnerBodyLayer in interface ConstCharacterVirtualSettings
      Returns:
      the index of the object layer
    • getInnerBodyShape

      public ConstShape getInnerBodyShape()
      Return the shape of the inner rigid body. The settings are unaffected. (native attribute: mInnerBodyShape)
      Specified by:
      getInnerBodyShape in interface ConstCharacterVirtualSettings
      Returns:
      the shape, or null for no inner body
    • getMass

      public float getMass()
      Return the character's mass. The settings are unaffected. (native attribute: mMass)
      Specified by:
      getMass in interface ConstCharacterVirtualSettings
      Returns:
      the mass (in kilograms)
    • getMaxCollisionIterations

      public int getMaxCollisionIterations()
      Return the maximum number of collision iterations. The settings are unaffected. (native attribute: mMaxCollisionIterations)
      Specified by:
      getMaxCollisionIterations in interface ConstCharacterVirtualSettings
      Returns:
      the number of iterations (≥0)
    • getMaxConstraintIterations

      public int getMaxConstraintIterations()
      Return how often to try stepping in the constraint solver. The settings are unaffected. (native attribute: mMaxConstraintIterations)
      Specified by:
      getMaxConstraintIterations in interface ConstCharacterVirtualSettings
      Returns:
      the number of iterations (≥0)
    • getMaxNumHits

      public int getMaxNumHits()
      Return the maximum number of hits to be collected. The settings are unaffected. (native attribute: mMaxNumHits)
      Specified by:
      getMaxNumHits in interface ConstCharacterVirtualSettings
      Returns:
      the limit (≥0)
    • getMaxStrength

      public float getMaxStrength()
      Return the maximum force applied to other bodies. The settings are unaffected. (native attribute: mMaxStrength)
      Specified by:
      getMaxStrength in interface ConstCharacterVirtualSettings
      Returns:
      the force (in Newtons)
    • getMinTimeRemaining

      public float getMinTimeRemaining()
      Return the early out threshold. The settings are unaffected. (native attribute: mMinTimeRemaining)
      Specified by:
      getMinTimeRemaining in interface ConstCharacterVirtualSettings
      Returns:
      the simulation time interval (in seconds)
    • getPenetrationRecoverySpeed

      public float getPenetrationRecoverySpeed()
      Return how quickly penetration is resolved. The settings are unaffected. (native attribute: mPenetrationRecoverySpeed)
      Specified by:
      getPenetrationRecoverySpeed in interface ConstCharacterVirtualSettings
      Returns:
      the resolution fraction (0=never resolved, 1=all in one update)
    • getPredictiveContactDistance

      public float getPredictiveContactDistance()
      Return the maximum range of predictive contacts. The settings are unaffected. (native attribute: mPredictiveContactDistance)
      Specified by:
      getPredictiveContactDistance in interface ConstCharacterVirtualSettings
      Returns:
      the distance (in meters)
    • getShapeOffset

      public Vec3 getShapeOffset()
      Copy the local offset applied to the shape. The settings are unaffected. (native attribute: mShapeOffset)
      Specified by:
      getShapeOffset in interface ConstCharacterVirtualSettings
      Returns:
      a new offset vector (in local coordinates)
    • getRefCount

      public int getRefCount()
      Count the active references to the native CharacterVirtualSettings. The settings are unaffected.
      Specified by:
      getRefCount in interface RefTarget
      Returns:
      the count (≥0)
    • setEmbedded

      public void setEmbedded()
      Mark the native CharacterVirtualSettings as embedded.
      Specified by:
      setEmbedded in interface RefTarget
    • toRef

      Create a counted reference to the native CharacterVirtualSettings.
      Specified by:
      toRef in interface RefTarget
      Returns:
      a new JVM object with a new native object assigned