Package com.github.stephengold.joltjni
Class CharacterRef
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Ref
com.github.stephengold.joltjni.CharacterRef
- All Implemented Interfaces:
ConstCharacter,ConstCharacterBase,ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A counted reference to a
Character. (native type:
Ref<Character>)-
Method Summary
Modifier and TypeMethodDescriptionReturn the ID of the body associated with this character.Return the location of the rigid body's center of mass using the locking body interface.getCenterOfMassPosition(boolean lockBodies) Return the location of the rigid body's center of mass.floatReturn the maximum slope on which the character can walk.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.intgetLayer()Return the character's object layer, using the locking body interface.intgetLayer(boolean lockBodies) Return the character's object layer.Copy the linear velocity of the character using the locking body interface.getLinearVelocity(boolean lockBodies) Copy the linear velocity of the character.Copy the location of the character using the locking body interface.getPosition(boolean lockBodies) Copy the location of the character.voidgetPositionAndRotation(RVec3 storeLocation, Quat storeOrientation) Copy the position of the associated body using the locking body interface.voidgetPositionAndRotation(RVec3 storeLocation, Quat storeOrientation, boolean lockBodies) Copy the position of the associated body.getPtr()Temporarily access the referencedCharacter.Copy the orientation of the character using the locking body interface.getRotation(boolean lockBodies) Copy the orientation of the character.getShape()Access the character's shape.getUp()Return the character's "up" direction.Calculate the character's local-to-system coordinate transform using the locking body interface.getWorldTransform(boolean lockBodies) Calculate the character's local-to-system coordinate transform.booleanisSlopeTooSteep(Vec3Arg normal) Test whether the specified normal direction is too steep.booleanTest whether the character is supported.voidsaveState(StateRecorder recorder) Save the character's state to the specified recorder.toRef()Create a counted reference to the nativeCharacter.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
-
getBodyId
Return the ID of the body associated with this character. The character is unaffected.- Specified by:
getBodyIdin interfaceConstCharacter- Returns:
- a new ID
-
getCenterOfMassPosition
Return the location of the rigid body's center of mass using the locking body interface. The character is unaffected.- Specified by:
getCenterOfMassPositionin interfaceConstCharacter- Returns:
- a new location vector (in system coordinates)
-
getCenterOfMassPosition
Return the location of the rigid body's center of mass. The character is unaffected.- Specified by:
getCenterOfMassPositionin interfaceConstCharacter- Parameters:
lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)- Returns:
- a new location vector (in system coordinates)
-
getCosMaxSlopeAngle
public float getCosMaxSlopeAngle()Return the maximum slope on which the character can walk. 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)
-
getLayer
public int getLayer()Return the character's object layer, using the locking body interface. The character is unaffected.- Specified by:
getLayerin interfaceConstCharacter- Returns:
- a layer index (≥0)
-
getLayer
public int getLayer(boolean lockBodies) Return the character's object layer. The character is unaffected.- Specified by:
getLayerin interfaceConstCharacter- Parameters:
lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)- Returns:
- a layer index (≥0)
-
getLinearVelocity
Copy the linear velocity of the character using the locking body interface. The character is unaffected.- Specified by:
getLinearVelocityin interfaceConstCharacter- Returns:
- a new velocity vector (meters per second in system coordinates)
-
getLinearVelocity
Copy the linear velocity of the character. The character is unaffected.- Specified by:
getLinearVelocityin interfaceConstCharacter- Parameters:
lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)- Returns:
- a new velocity vector (meters per second in system coordinates)
-
getPosition
Copy the location of the character using the locking body interface. The character is unaffected.- Specified by:
getPositionin interfaceConstCharacter- Returns:
- a new location vector (in system coordinates)
-
getPosition
Copy the location of the character. The character is unaffected.- Specified by:
getPositionin interfaceConstCharacter- Parameters:
lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)- Returns:
- a new location vector (in system coordinates)
-
getPositionAndRotation
Copy the position of the associated body using the locking body interface. The character is unaffected.- Specified by:
getPositionAndRotationin interfaceConstCharacter- Parameters:
storeLocation- the desired location (in system coordinates, not null, unaffected)storeOrientation- the desired orientation (in system coordinates, not null, unaffected)
-
getPositionAndRotation
Copy the position of the associated body. The character is unaffected.- Specified by:
getPositionAndRotationin interfaceConstCharacter- Parameters:
storeLocation- the desired location (in system coordinates, not null, unaffected)storeOrientation- the desired orientation (in system coordinates, not null, unaffected)lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)
-
getRotation
Copy the orientation of the character using the locking body interface. The character is unaffected.- Specified by:
getRotationin interfaceConstCharacter- Returns:
- a new rotation quaternion (in system coordinates)
-
getRotation
Copy the orientation of the character. The character is unaffected.- Specified by:
getRotationin interfaceConstCharacter- Parameters:
lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)- Returns:
- a new rotation quaternion (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
-
getWorldTransform
Calculate the character's local-to-system coordinate transform using the locking body interface. The character is unaffected.- Specified by:
getWorldTransformin interfaceConstCharacter- Returns:
- a new coordinate transform matrix
-
getWorldTransform
Calculate the character's local-to-system coordinate transform. The character is unaffected.- Specified by:
getWorldTransformin interfaceConstCharacter- Parameters:
lockBodies- true→use the locking body interface, false→use the non-locking body interface (default=true)- Returns:
- a new transform matrix
-
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)
-
getPtr
Temporarily access the referencedCharacter. -
toRef
Create a counted reference to the nativeCharacter.
-