Package com.github.stephengold.joltjni
Class CharacterBase
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.CharacterBase
- All Implemented Interfaces:
ConstCharacterBase,ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
- Direct Known Subclasses:
Character,CharacterVirtual
Base class to represent a player navigating a
PhysicsSystem.-
Method Summary
Modifier and TypeMethodDescriptionfloatReturn the maximum slope the character can walk on.Return the body ID of the supporting surface.Access the material of the supporting surface.Return the normal direction at the point of contact with the supporting surface.Return the location of the point of contact with the supporting surface.Return the relationship between the character and its supporting surface.Identify the face on the supporting surface where contact is occurring.longReturn the user data of the supporting surface.Return the world-space velocity of the supporting surface.getShape()Access the character's shape.getUp()Return 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.voidsetMaxSlopeAngle(float angle) Alter the maximum slope that character can walk on.voidAlter the character's "up" direction.abstract ReftoRef()Create a counted reference to the nativeCharacterBase.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, 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, va
-
Method Details
-
restoreState
Restore the character's state from the specified recorder.- Parameters:
recorder- the recorder to restore from (not null)
-
setMaxSlopeAngle
public void setMaxSlopeAngle(float angle) Alter the maximum slope that 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 (not null, unaffected, default=(0,1,0))
-
toRef
Create a counted reference to the nativeCharacterBase.- Returns:
- a new JVM object with a new native object assigned
-
getCosMaxSlopeAngle
public float getCosMaxSlopeAngle()Return the maximum slope the character can walk on. The character is unaffected.- Specified by:
getCosMaxSlopeAnglein interfaceConstCharacterBase- Returns:
- the cosine of the slope angle
-
getGroundBodyId
Return the body ID of the supporting surface. The character is unaffected.- Specified by:
getGroundBodyIdin interfaceConstCharacterBase- Returns:
- a new ID
-
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
Return 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
Return 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
Identify the face on the supporting surface where contact is occurring. The character is unaffected.- Specified by:
getGroundSubShapeIdin interfaceConstCharacterBase- Returns:
- a new ID
-
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
Return 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
-
getUp
Return 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 (not null, unaffected)- Returns:
- true if too steep, otherwise false
-
isSupported
public boolean isSupported()Test whether the character is supported. The character is unaffected.- Specified by:
isSupportedin interfaceConstCharacterBase- Returns:
- true if supported, otherwise false
-
saveState
Save the character's state to the specified recorder.- Specified by:
saveStatein interfaceConstCharacterBase- Parameters:
recorder- the recorder to save to (not null)
-