java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.CharacterBase
- All Implemented Interfaces:
ConstCharacterBase,ConstJoltPhysicsObject,RefTarget,AutoCloseable,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
Character,CharacterVirtual
Base class to represent a player navigating a
PhysicsSystem.-
Method Summary
Modifier and TypeMethodDescriptionfloatReturn the maximum slope that the character can walk on.intReturn the body ID of the supporting surface.Access the material of the supporting surface.Copy the normal direction at the point of contact with the supporting surface.Copy the location of the point of contact with the supporting surface.Return the relationship between the character and its supporting surface.intIdentify the face on the supporting surface where contact is occurring.longReturn the user data of the supporting surface.Copy the world-space velocity of the supporting surface.intCount the active references to the nativeCharacterBase.getShape()Access the character's shape.voidUpdate the specified counted reference to refer to the character's shape.getUp()Copy the character's "up" direction.booleanisSlopeTooSteep(Vec3Arg normal) Test whether the specified normal direction is too steep.booleanTest whether the character is supported.voidrestoreState(StateRecorder recorder) Restore the character's state from the specified recorder.voidsaveState(StateRecorder recorder) Save the character's state to the specified recorder.voidMark the nativeCharacterBaseas embedded.voidsetMaxSlopeAngle(float angle) Alter the maximum slope that the character can walk on.voidAlter the character's "up" direction.Methods 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.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
restoreState
Restore the character's state from the specified recorder.- Parameters:
recorder- the recorder to restore from (notnull)
-
setMaxSlopeAngle
public void setMaxSlopeAngle(float angle) Alter the maximum slope that the character can walk on.- Parameters:
angle- the desired slope angle (in radians, default=5*Pi/18)
-
setUp
Alter the character's "up" direction.- Parameters:
up- the desired direction (notnull, unaffected, default=(0,1,0))
-
getCosMaxSlopeAngle
public float getCosMaxSlopeAngle()Return the maximum slope that the character can walk on. The character is unaffected.- Specified by:
getCosMaxSlopeAnglein interfaceConstCharacterBase- Returns:
- the cosine of the slope angle
-
getGroundBodyId
public int getGroundBodyId()Return the body ID of the supporting surface. The character is unaffected. (native function: GetGroundBodyID)- Specified by:
getGroundBodyIdin interfaceConstCharacterBase- Returns:
- the
BodyIDvalue
-
getGroundMaterial
Access the material of the supporting surface. The character is unaffected.- Specified by:
getGroundMaterialin interfaceConstCharacterBase- Returns:
- a new JVM object with the pre-existing native object assigned, or
else
null
-
getGroundNormal
Copy the normal direction at the point of contact with the supporting surface. The character is unaffected.- Specified by:
getGroundNormalin interfaceConstCharacterBase- Returns:
- a new direction vector (in system coordinates)
-
getGroundPosition
Copy the location of the point of contact with the supporting surface. The character is unaffected.- Specified by:
getGroundPositionin interfaceConstCharacterBase- Returns:
- a new location vector (in system coordinates)
-
getGroundState
Return the relationship between the character and its supporting surface. The character is unaffected.- Specified by:
getGroundStatein interfaceConstCharacterBase- Returns:
- an enum value (not
null)
-
getGroundSubShapeId
public int getGroundSubShapeId()Identify the face on the supporting surface where contact is occurring. The character is unaffected.- Specified by:
getGroundSubShapeIdin interfaceConstCharacterBase- Returns:
- a
SubShapeIDvalue
-
getGroundUserData
public long getGroundUserData()Return the user data of the supporting surface. The character is unaffected.- Specified by:
getGroundUserDatain interfaceConstCharacterBase- Returns:
- the 64-bit value
-
getGroundVelocity
Copy the world-space velocity of the supporting surface. The character is unaffected.- Specified by:
getGroundVelocityin interfaceConstCharacterBase- Returns:
- a new velocity vector (meters per second in system coordinates)
-
getShape
Access the character's shape. The character is unaffected.- Specified by:
getShapein interfaceConstCharacterBase- Returns:
- a new immutable JVM object with the pre-existing native object
assigned, or
nullif none
-
getShape
Update the specified counted reference to refer to the character's shape. The character is unaffected.- Specified by:
getShapein interfaceConstCharacterBase- Parameters:
storeRef- storage for the reference (notnull, modified)
-
getUp
Copy the character's "up" direction. The character is unaffected.- Specified by:
getUpin interfaceConstCharacterBase- Returns:
- a new direction vector
-
isSlopeTooSteep
Test whether the specified normal direction is too steep. The character is unaffected.- Specified by:
isSlopeTooSteepin interfaceConstCharacterBase- Parameters:
normal- the surface normal to test (notnull, unaffected)- Returns:
trueif too steep, otherwisefalse
-
isSupported
public boolean isSupported()Test whether the character is supported. The character is unaffected.- Specified by:
isSupportedin interfaceConstCharacterBase- Returns:
trueif supported, otherwisefalse
-
saveState
Save the character's state to the specified recorder. The character is unaffected.- Specified by:
saveStatein interfaceConstCharacterBase- Parameters:
recorder- the recorder to save to (notnull)
-
getRefCount
public int getRefCount()Count the active references to the nativeCharacterBase. The character is unaffected.- Specified by:
getRefCountin interfaceConstCharacterBase- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeCharacterBaseas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-