Package com.github.stephengold.joltjni
Class CharacterVirtualRef
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Ref
com.github.stephengold.joltjni.CharacterVirtualRef
- All Implemented Interfaces:
ConstCharacterBase,ConstCharacterVirtual,ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A counted reference to a
CharacterVirtual. (native type:
Ref<CharacterVirtual>)-
Method Summary
Modifier and TypeMethodDescriptioncancelVelocityTowardsSteepSlopes(Vec3Arg desiredVelocity) Convert the specified velocity to one that won't climb steep slopes.booleancanWalkStairs(Vec3Arg desiredVelocity) Test whether the character has moved onto a steep slope.Access the list of contacts.Calculate the location of the character's center of mass.Calculate the local-to-system transform of the character's center of mass.floatReturn the thickness of the character's padding.floatReturn the maximum slope on which the character can walk.booleanTest whether enhanced internal edge removal is enabled.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.floatReturn the maximum angle for merging during hit reduction.Return the ID of the inner body.Return the linear velocity of the character.floatgetMass()Return the character's mass.booleanTest whether the last collision check discarded one or more hits.intReturn the maximum number of hits to be collected.floatReturn the maximum force applied to other bodies.floatReturn how quickly penetration is resolved.Copy the location of the character.getPtr()Temporarily access the referencedCharacterVirtual.Copy the orientation of the character.getShape()Access the character's shape.Copy the local offset applied to the shape.getUp()Return the character's "up" direction.longReturn the character's user data: can be used for anything.Calculate the character's local-to-system coordinate transform.booleanhasCollidedWith(ConstBodyId bodyId) Test whether the character is in contact with or collided with the specified body during the previous time step.booleanhasCollidedWith(ConstCharacterVirtual otherCharacter) Test whether the character is in contact with or has collided with the specified character during the previous time step.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 nativeCharacterVirtual.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
-
cancelVelocityTowardsSteepSlopes
Convert the specified velocity to one that won't climb steep slopes. The character is unaffected.- Specified by:
cancelVelocityTowardsSteepSlopesin 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:
canWalkStairsin interfaceConstCharacterVirtual- Parameters:
desiredVelocity- velocity vector (in system coordinates, not null, unaffected)- Returns:
- true if too step to walk, otherwise false
-
getActiveContacts
Access the list of contacts. The character is unaffected.- Specified by:
getActiveContactsin 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:
getCenterOfMassPositionin 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:
getCenterOfMassTransformin 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:
getCharacterPaddingin interfaceConstCharacterVirtual- Returns:
- the thickness (in meters)
-
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
-
getEnhancedInternalEdgeRemoval
public boolean getEnhancedInternalEdgeRemoval()Test whether enhanced internal edge removal is enabled. The character is unaffected.- Specified by:
getEnhancedInternalEdgeRemovalin interfaceConstCharacterVirtual- Returns:
- true if enabled, otherwise false
-
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)
-
getHitReductionCosMaxAngle
public float getHitReductionCosMaxAngle()Return the maximum angle for merging during hit reduction. The character is unaffected.- Specified by:
getHitReductionCosMaxAnglein interfaceConstCharacterVirtual- Returns:
- the cosine of the maximum angle, or -1 if hit reduction is disabled
-
getInnerBodyId
Return the ID of the inner body. The character is unaffected.- Specified by:
getInnerBodyIdin interfaceConstCharacterVirtual- Returns:
- the ID, or
nullif none
-
getLinearVelocity
Return the linear velocity of the character. The character is unaffected.- Specified by:
getLinearVelocityin 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:
getMassin 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:
getMaxHitsExceededin interfaceConstCharacterVirtual- Returns:
- true if discarded hits, otherwise false
-
getMaxNumHits
public int getMaxNumHits()Return the maximum number of hits to be collected. The character is unaffected.- Specified by:
getMaxNumHitsin interfaceConstCharacterVirtual- Returns:
- the limit (≥0)
-
getMaxStrength
public float getMaxStrength()Return the maximum force applied to other bodies. The character is unaffected.- Specified by:
getMaxStrengthin interfaceConstCharacterVirtual- Returns:
- the force (in Newtons)
-
getPenetrationRecoverySpeed
public float getPenetrationRecoverySpeed()Return how quickly penetration is resolved. The character is unaffected.- Specified by:
getPenetrationRecoverySpeedin 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:
getPositionin interfaceConstCharacterVirtual- Returns:
- a new location vector (in system coordinates)
-
getRotation
Copy the orientation of the character. The character is unaffected.- Specified by:
getRotationin interfaceConstCharacterVirtual- 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
-
getShapeOffset
Copy the local offset applied to the shape. The character is unaffected.- Specified by:
getShapeOffsetin interfaceConstCharacterVirtual- Returns:
- a new offset vector (in local coordinates)
-
getUp
Return the character's "up" direction. The character is unaffected.- Specified by:
getUpin 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:
getUserDatain interfaceConstCharacterVirtual- Returns:
- the value
-
getWorldTransform
Calculate the character's local-to-system coordinate transform. The character is unaffected.- Specified by:
getWorldTransformin interfaceConstCharacterVirtual- Returns:
- a new transform matrix
-
hasCollidedWith
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:
hasCollidedWithin interfaceConstCharacterVirtual- Parameters:
bodyId- the ID of the body to test against (not null, unaffected)- Returns:
- true if contact or collision, otherwise false
-
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:
hasCollidedWithin interfaceConstCharacterVirtual- Parameters:
otherCharacter- the character to test against (not null, unaffected)- Returns:
- true if contact or collision, otherwise false
-
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 referencedCharacterVirtual. -
toRef
Create a counted reference to the nativeCharacterVirtual.
-