Package com.github.stephengold.joltjni
Class CharacterVirtualSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.CharacterBaseSettings
com.github.stephengold.joltjni.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 Summary
ConstructorsConstructorDescriptionInstantiate default settings.Instantiate a copy of the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionDetermine whether the character will move through back-facing triangles.floatReturn how far the character tries to stay away from the geometry.floatReturn the collision tolerance.floatReturn the maximum angle for merging during hit reduction.intReturn the object layer that the inner rigid body will be added to.Return the shape of the inner rigid body.floatgetMass()Return the character's mass.intReturn the maximum number of collision iterations.intReturn how often to try stepping in the constraint solver.intReturn the maximum number of hits to be collected.floatReturn the maximum force applied to other bodies.floatReturn the early out threshold.floatReturn how quickly penetration is resolved.floatReturn the maximum range of predictive contacts.Copy the local offset applied to the shape.voidsetBackFaceMode(EBackFaceMode mode) Alter whether the character will move through back facing triangles.voidsetCharacterPadding(float padding) Alter how far the character tries to stay away from the geometry.voidsetCollisionTolerance(float tolerance) Alter the collision tolerance.voidMark the nativeCharacterVirtualSettingsas embedded.voidsetHitReductionCosMaxAngle(int cosine) Alter the maximum angle for merging during hit reduction.voidsetInnerBodyLayer(int objectLayer) Alter the object layer that the inner rigid body will be added to.voidsetInnerBodyShape(ConstShape shape) Replace the shape of the inner rigid body.voidsetMass(float mass) Alter the character's mass.voidsetMaxCollisionIterations(int numIterations) Alter the maximum number of collision iterations.voidsetMaxConstraintIterations(int numIterations) Alter how often to try stepping in the constraint solver.voidsetMaxNumHits(int numHits) Alter the maximum number of hits to collect.voidsetMaxStrength(float force) Alter the maximum force applied to other bodies.voidsetMinTimeRemaining(float interval) Alter the early out threshold.voidsetPenetrationRecoverySpeed(float fraction) Alter how quickly penetration is resolved.voidsetPredictiveContactDistance(float distance) Alter the maximum range of predictive contacts.voidsetShapeOffset(Vec3Arg offset) Alter the local offset applied to the shape.toRef()Create a counted reference to the nativeCharacterVirtualSettings.Methods inherited from class com.github.stephengold.joltjni.CharacterBaseSettings
getEnhancedInternalEdgeRemoval, getMaxSlopeAngle, getRefCount, getShape, getSupportingVolume, getUp, setEnhancedInternalEdgeRemoval, setMaxSlopeAngle, setShape, setSupportingVolume, setUpMethods 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.ConstCharacterBaseSettings
getEnhancedInternalEdgeRemoval, getMaxSlopeAngle, getRefCount, getShape, getSupportingVolume, getUpMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVaMethods inherited from interface com.github.stephengold.joltjni.template.RefTarget
getRefCount
-
Constructor Details
-
CharacterVirtualSettings
public CharacterVirtualSettings()Instantiate default settings. -
CharacterVirtualSettings
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
Method Details
-
setBackFaceMode
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
Replace the shape of the inner rigid body. (native attribute: mInnerBodyShape)- Parameters:
shape- the desired shape, ornullfor 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
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
Determine whether the character will move through back-facing triangles. The settings are unaffected. (native attribute: mBackFaceMode)- Specified by:
getBackFaceModein interfaceConstCharacterVirtualSettings- 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:
getCharacterPaddingin interfaceConstCharacterVirtualSettings- Returns:
- the desired distance (in meters)
-
getCollisionTolerance
public float getCollisionTolerance()Return the collision tolerance. The settings are unaffected. (native attribute: mCollisionTolerance)- Specified by:
getCollisionTolerancein interfaceConstCharacterVirtualSettings- 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:
getHitReductionCosMaxAnglein interfaceConstCharacterVirtualSettings- 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:
getInnerBodyLayerin interfaceConstCharacterVirtualSettings- Returns:
- the index of the object layer
-
getInnerBodyShape
Return the shape of the inner rigid body. The settings are unaffected. (native attribute: mInnerBodyShape)- Specified by:
getInnerBodyShapein interfaceConstCharacterVirtualSettings- Returns:
- the shape, or
nullfor no inner body
-
getMass
public float getMass()Return the character's mass. The settings are unaffected. (native attribute: mMass)- Specified by:
getMassin interfaceConstCharacterVirtualSettings- 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:
getMaxCollisionIterationsin interfaceConstCharacterVirtualSettings- 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:
getMaxConstraintIterationsin interfaceConstCharacterVirtualSettings- 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:
getMaxNumHitsin interfaceConstCharacterVirtualSettings- 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:
getMaxStrengthin interfaceConstCharacterVirtualSettings- Returns:
- the force (in Newtons)
-
getMinTimeRemaining
public float getMinTimeRemaining()Return the early out threshold. The settings are unaffected. (native attribute: mMinTimeRemaining)- Specified by:
getMinTimeRemainingin interfaceConstCharacterVirtualSettings- 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:
getPenetrationRecoverySpeedin interfaceConstCharacterVirtualSettings- 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:
getPredictiveContactDistancein interfaceConstCharacterVirtualSettings- Returns:
- the distance (in meters)
-
getShapeOffset
Copy the local offset applied to the shape. The settings are unaffected. (native attribute: mShapeOffset)- Specified by:
getShapeOffsetin interfaceConstCharacterVirtualSettings- Returns:
- a new offset vector (in local coordinates)
-
setEmbedded
public void setEmbedded()Mark the nativeCharacterVirtualSettingsas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeCharacterVirtualSettings.
-