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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDetermine whether the character will move through back-facing triangles.float
Return how far the character tries to stay away from the geometry.float
Return the collision tolerance.float
Return the maximum angle for merging during hit reduction.int
Return the object layer that the inner rigid body will be added to.Return the shape of the inner rigid body.float
getMass()
Return the character's mass.int
Return the maximum number of collision iterations.int
Return how often to try stepping in the constraint solver.int
Return the maximum number of hits to be collected.float
Return the maximum force applied to other bodies.float
Return the early out threshold.float
Return how quickly penetration is resolved.float
Return the maximum range of predictive contacts.int
Count the active references to the nativeCharacterVirtualSettings
.Copy the local offset applied to the shape.void
setBackFaceMode
(EBackFaceMode mode) Alter whether the character will move through back facing triangles.void
setCharacterPadding
(float padding) Alter how far the character tries to stay away from the geometry.void
setCollisionTolerance
(float tolerance) Alter the collision tolerance.void
Mark the nativeCharacterVirtualSettings
as embedded.void
setHitReductionCosMaxAngle
(int cosine) Alter the maximum angle for merging during hit reduction.void
setInnerBodyLayer
(int objectLayer) Alter the object layer that the inner rigid body will be added to.void
setInnerBodyShape
(ConstShape shape) Replace the shape of the inner rigid body.void
setMass
(float mass) Alter the character's mass.void
setMaxCollisionIterations
(int numIterations) Alter the maximum number of collision iterations.void
setMaxConstraintIterations
(int numIterations) Alter how often to try stepping in the constraint solver.void
setMaxNumHits
(int numHits) Alter the maximum number of hits to collect.void
setMaxStrength
(float force) Alter the maximum force applied to other bodies.void
setMinTimeRemaining
(float interval) Alter the early out threshold.void
setPenetrationRecoverySpeed
(float fraction) Alter how quickly penetration is resolved.void
setPredictiveContactDistance
(float distance) Alter the maximum range of predictive contacts.void
setShapeOffset
(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, getShape, getSupportingVolume, getUp, setEnhancedInternalEdgeRemoval, setMaxSlopeAngle, setShape, setSupportingVolume, setUp
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.ConstCharacterBaseSettings
getEnhancedInternalEdgeRemoval, getMaxSlopeAngle, getShape, getSupportingVolume, getUp
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
CharacterVirtualSettings
public CharacterVirtualSettings()Instantiate default settings.
-
-
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, ornull
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
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:
getBackFaceMode
in 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:
getCharacterPadding
in interfaceConstCharacterVirtualSettings
- 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 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:
getHitReductionCosMaxAngle
in 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:
getInnerBodyLayer
in 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:
getInnerBodyShape
in interfaceConstCharacterVirtualSettings
- 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 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:
getMaxCollisionIterations
in 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:
getMaxConstraintIterations
in 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:
getMaxNumHits
in 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:
getMaxStrength
in interfaceConstCharacterVirtualSettings
- 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 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:
getPenetrationRecoverySpeed
in 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:
getPredictiveContactDistance
in interfaceConstCharacterVirtualSettings
- Returns:
- the distance (in meters)
-
getShapeOffset
Copy the local offset applied to the shape. The settings are unaffected. (native attribute: mShapeOffset)- Specified by:
getShapeOffset
in interfaceConstCharacterVirtualSettings
- Returns:
- a new offset vector (in local coordinates)
-
getRefCount
public int getRefCount()Count the active references to the nativeCharacterVirtualSettings
. The settings are unaffected.- Specified by:
getRefCount
in interfaceRefTarget
- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeCharacterVirtualSettings
as embedded.- Specified by:
setEmbedded
in interfaceRefTarget
-
toRef
Create a counted reference to the nativeCharacterVirtualSettings
.
-