Package com.github.stephengold.joltjni
Class CharacterVirtualRefC
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.CharacterVirtualRefC
- All Implemented Interfaces:
ConstCharacterBase
,ConstCharacterVirtual
,ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A counted reference to a
ConstCharacter
. (native type:
RefConst<Character>
)-
Method Summary
Modifier and TypeMethodDescriptioncancelVelocityTowardsSteepSlopes
(Vec3Arg desiredVelocity) Convert the specified velocity to one that won't climb steep slopes.boolean
canWalkStairs
(Vec3Arg desiredVelocity) Test whether the character has moved onto a steep slope.Copy the list of active contacts.Calculate the location of the character's center of mass.Calculate the local-to-system transform of the character's center of mass.float
Return the thickness of the character's padding.float
Return the maximum slope the character can walk on.boolean
Test whether enhanced internal edge removal is enabled.int
Return 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.int
Identify the face on the supporting surface where contact is occurring.long
Return the user data of the supporting surface.Copy the world-space velocity of the supporting surface.float
Return the maximum angle for merging during hit reduction.int
getId()
Return the character's ID.int
Return the ID of the inner body.Copy the linear velocity of the character.float
getMass()
Return the character's mass.boolean
Test whether the last collision check discarded one or more hits.int
Return the maximum number of hits to be collected.float
Return the maximum force applied to other bodies.float
Return how quickly penetration is resolved.Copy the location of the character.void
getPositionAndRotation
(RVec3 storeLocation, Quat storeOrientation) Copy the position of the character.getPtr()
Temporarily access the referencedConstCharacter
.Copy the orientation of the character.getShape()
Access the character's shape.Copy the local offset applied to the shape.Return a TransformedShape that represents the volume occupied by the character.getUp()
Copy the character's "up" direction.long
Return the character's user data: can be used for anything.Calculate the character's local-to-system coordinate transform.boolean
hasCollidedWith
(int bodyId) Test whether the character is in contact with or collided with the specified body during the previous time step.boolean
hasCollidedWith
(ConstCharacterVirtual otherCharacter) Test whether the character is in contact with or has collided with the specified character during the previous time step.boolean
isSlopeTooSteep
(Vec3Arg normal) Test whether the specified normal direction is too steep.boolean
Test whether the character is supported.void
saveState
(StateRecorder recorder) Save the character's state to the specified recorder.toRefC()
Create another counted reference to the nativeCharacterVirtual
.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.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
getPtr
Temporarily access the referencedConstCharacter
.- Returns:
- a new JVM object with the pre-existing native object assigned
-
cancelVelocityTowardsSteepSlopes
Convert the specified velocity to one that won't climb steep slopes. The character is unaffected.- Specified by:
cancelVelocityTowardsSteepSlopes
in interfaceConstCharacterVirtual
- Parameters:
desiredVelocity
- velocity vector (in system coordinates, not null, unaffected)- Returns:
- a new velocity vector (in system coordinates)
-
canWalkStairs
Test whether the character has moved onto a steep slope. The character is unaffected.- Specified by:
canWalkStairs
in interfaceConstCharacterVirtual
- Parameters:
desiredVelocity
- velocity vector (in system coordinates, not null, unaffected)- Returns:
true
if too step to walk, otherwisefalse
-
getActiveContacts
Copy the list of active contacts. The character is unaffected.- Specified by:
getActiveContacts
in interfaceConstCharacterVirtual
- Returns:
- a new JVM object with the pre-existing native object assigned
-
getCenterOfMassPosition
Calculate the location of the character's center of mass. The character is unaffected.- Specified by:
getCenterOfMassPosition
in interfaceConstCharacterVirtual
- Returns:
- a new location vector (in system coordinates)
-
getCenterOfMassTransform
Calculate the local-to-system transform of the character's center of mass. The character is unaffected.- Specified by:
getCenterOfMassTransform
in interfaceConstCharacterVirtual
- Returns:
- a new coordinate transform matrix
-
getCharacterPadding
public float getCharacterPadding()Return the thickness of the character's padding. The character is unaffected.- Specified by:
getCharacterPadding
in interfaceConstCharacterVirtual
- Returns:
- the thickness (in meters)
-
getCosMaxSlopeAngle
public float getCosMaxSlopeAngle()Return the maximum slope the character can walk on. The character is unaffected.- Specified by:
getCosMaxSlopeAngle
in interfaceConstCharacterBase
- Returns:
- the cosine of the slope angle
-
getEnhancedInternalEdgeRemoval
public boolean getEnhancedInternalEdgeRemoval()Test whether enhanced internal edge removal is enabled. The character is unaffected.- Specified by:
getEnhancedInternalEdgeRemoval
in interfaceConstCharacterVirtual
- Returns:
true
if enabled, otherwisefalse
-
getGroundBodyId
public int getGroundBodyId()Return the body ID of the supporting surface. The character is unaffected.- Specified by:
getGroundBodyId
in interfaceConstCharacterBase
- Returns:
- the
BodyID
value
-
getGroundMaterial
Access the material of the supporting surface. The character is unaffected.- Specified by:
getGroundMaterial
in 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:
getGroundNormal
in 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:
getGroundPosition
in 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:
getGroundState
in 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:
getGroundSubShapeId
in interfaceConstCharacterBase
- Returns:
- a
SubShapeId
value
-
getGroundUserData
public long getGroundUserData()Return the user data of the supporting surface. The character is unaffected.- Specified by:
getGroundUserData
in interfaceConstCharacterBase
- Returns:
- the 64-bit value
-
getGroundVelocity
Copy the world-space velocity of the supporting surface. The character is unaffected.- Specified by:
getGroundVelocity
in interfaceConstCharacterBase
- Returns:
- a new velocity vector (meters per second in system coordinates)
-
getHitReductionCosMaxAngle
public float getHitReductionCosMaxAngle()Return the maximum angle for merging during hit reduction. The character is unaffected.- Specified by:
getHitReductionCosMaxAngle
in interfaceConstCharacterVirtual
- Returns:
- the cosine of the maximum angle, or -1 if hit reduction is disabled
-
getId
public int getId()Return the character's ID. The character is unaffected. (native method: GetID)- Specified by:
getId
in interfaceConstCharacterVirtual
- Returns:
- a
CharacterId
value
-
getInnerBodyId
public int getInnerBodyId()Return the ID of the inner body. The character is unaffected. (native method: GetInnerBodyID)- Specified by:
getInnerBodyId
in interfaceConstCharacterVirtual
- Returns:
- the
BodyID
value
-
getLinearVelocity
Copy the linear velocity of the character. The character is unaffected.- Specified by:
getLinearVelocity
in interfaceConstCharacterVirtual
- Returns:
- a new velocity vector (meters per second in system coordinates)
-
getMass
public float getMass()Return the character's mass. The character is unaffected.- Specified by:
getMass
in interfaceConstCharacterVirtual
- Returns:
- the mass (in kilograms)
-
getMaxHitsExceeded
public boolean getMaxHitsExceeded()Test whether the last collision check discarded one or more hits. The character is unaffected.- Specified by:
getMaxHitsExceeded
in interfaceConstCharacterVirtual
- Returns:
true
if discarded hits, otherwisefalse
-
getMaxNumHits
public int getMaxNumHits()Return the maximum number of hits to be collected. The character is unaffected.- Specified by:
getMaxNumHits
in interfaceConstCharacterVirtual
- Returns:
- the limit (≥0)
-
getMaxStrength
public float getMaxStrength()Return the maximum force applied to other bodies. The character is unaffected.- Specified by:
getMaxStrength
in interfaceConstCharacterVirtual
- Returns:
- the force (in Newtons)
-
getPenetrationRecoverySpeed
public float getPenetrationRecoverySpeed()Return how quickly penetration is resolved. The character is unaffected.- Specified by:
getPenetrationRecoverySpeed
in interfaceConstCharacterVirtual
- Returns:
- the resolution fraction (0=never resolved, 1=all in one update)
-
getPosition
Copy the location of the character. The character is unaffected.- Specified by:
getPosition
in interfaceConstCharacterVirtual
- Returns:
- a new location vector (in system coordinates)
-
getPositionAndRotation
Copy the position of the character. The character is unaffected.- Specified by:
getPositionAndRotation
in interfaceConstCharacterVirtual
- Parameters:
storeLocation
- storage for the location (in system coordinates, not null, modified)storeOrientation
- storage for the orientation (in system coordinates, not null, modified)
-
getRotation
Copy the orientation of the character. The character is unaffected.- Specified by:
getRotation
in interfaceConstCharacterVirtual
- Returns:
- a new rotation quaternion (in system coordinates)
-
getShape
Access the character's shape. The character is unaffected.- Specified by:
getShape
in interfaceConstCharacterBase
- Returns:
- a new immutable JVM object with the pre-existing native object
assigned, or
null
if none
-
getShapeOffset
Copy the local offset applied to the shape. The character is unaffected.- Specified by:
getShapeOffset
in interfaceConstCharacterVirtual
- Returns:
- a new offset vector (in local coordinates)
-
getTransformedShape
Return a TransformedShape that represents the volume occupied by the character. The character is unaffected.- Specified by:
getTransformedShape
in interfaceConstCharacterVirtual
- Returns:
- a new object
-
getUp
Copy the character's "up" direction. The character is unaffected.- Specified by:
getUp
in interfaceConstCharacterBase
- Returns:
- a new direction vector
-
getUserData
public long getUserData()Return the character's user data: can be used for anything. The character is unaffected.- Specified by:
getUserData
in interfaceConstCharacterVirtual
- Returns:
- the value
-
getWorldTransform
Calculate the character's local-to-system coordinate transform. The character is unaffected.- Specified by:
getWorldTransform
in interfaceConstCharacterVirtual
- Returns:
- a new transform matrix
-
hasCollidedWith
public boolean hasCollidedWith(int bodyId) Test whether the character is in contact with or collided with the specified body during the previous time step. The character is unaffected.- Specified by:
hasCollidedWith
in interfaceConstCharacterVirtual
- Parameters:
bodyId
- the ID of the body to test against- Returns:
true
if contact or collision, otherwisefalse
-
hasCollidedWith
Test whether the character is in contact with or has collided with the specified character during the previous time step. The current character is unaffected.- Specified by:
hasCollidedWith
in interfaceConstCharacterVirtual
- Parameters:
otherCharacter
- the character to test against (not null, unaffected)- Returns:
true
if contact or collision, otherwisefalse
-
isSlopeTooSteep
Test whether the specified normal direction is too steep. The character is unaffected.- Specified by:
isSlopeTooSteep
in interfaceConstCharacterBase
- Parameters:
normal
- the surface normal to test (not null, unaffected)- Returns:
true
if too steep, otherwisefalse
-
isSupported
public boolean isSupported()Test whether the character is supported. The character is unaffected.- Specified by:
isSupported
in interfaceConstCharacterBase
- Returns:
true
if supported, otherwisefalse
-
saveState
Save the character's state to the specified recorder. The character is unaffected.- Specified by:
saveState
in interfaceConstCharacterBase
- Parameters:
recorder
- the recorder to save to (not null)
-
toRefC
Create another counted reference to the nativeCharacterVirtual
.- Specified by:
toRefC
in interfaceConstCharacterVirtual
- Returns:
- a new JVM object with a new native object assigned
-