Class CharacterVirtualRef

All Implemented Interfaces:
ConstCharacterBase, ConstCharacterVirtual, ConstJoltPhysicsObject, AutoCloseable, Comparable<ConstJoltPhysicsObject>

public final class CharacterVirtualRef extends Ref implements ConstCharacterVirtual
A counted reference to a CharacterVirtual. (native type: Ref<CharacterVirtual>)
  • Method Details

    • cancelVelocityTowardsSteepSlopes

      public Vec3 cancelVelocityTowardsSteepSlopes(Vec3Arg desiredVelocity)
      Convert the specified velocity to one that won't climb steep slopes. The character is unaffected.
      Specified by:
      cancelVelocityTowardsSteepSlopes in interface ConstCharacterVirtual
      Parameters:
      desiredVelocity - velocity vector (in system coordinates, not null, unaffected)
      Returns:
      a new velocity vector (in system coordinates)
    • canWalkStairs

      public boolean canWalkStairs(Vec3Arg desiredVelocity)
      Test whether the character has moved onto a steep slope. The character is unaffected.
      Specified by:
      canWalkStairs in interface ConstCharacterVirtual
      Parameters:
      desiredVelocity - velocity vector (in system coordinates, not null, unaffected)
      Returns:
      true if too step to walk, otherwise false
    • getActiveContacts

      public ContactList getActiveContacts()
      Access the list of contacts. The character is unaffected.
      Specified by:
      getActiveContacts in interface ConstCharacterVirtual
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getCenterOfMassPosition

      public RVec3 getCenterOfMassPosition()
      Calculate the location of the character's center of mass. The character is unaffected.
      Specified by:
      getCenterOfMassPosition in interface ConstCharacterVirtual
      Returns:
      a new location vector (in system coordinates)
    • getCenterOfMassTransform

      public RMat44 getCenterOfMassTransform()
      Calculate the local-to-system transform of the character's center of mass. The character is unaffected.
      Specified by:
      getCenterOfMassTransform in interface ConstCharacterVirtual
      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 interface ConstCharacterVirtual
      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:
      getCosMaxSlopeAngle in interface ConstCharacterBase
      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 interface ConstCharacterVirtual
      Returns:
      true if enabled, otherwise false
    • getGroundBodyId

      public BodyId getGroundBodyId()
      Return the body ID of the supporting surface. The character is unaffected.
      Specified by:
      getGroundBodyId in interface ConstCharacterBase
      Returns:
      a new ID
    • getGroundMaterial

      public ConstPhysicsMaterial getGroundMaterial()
      Access the material of the supporting surface. The character is unaffected.
      Specified by:
      getGroundMaterial in interface ConstCharacterBase
      Returns:
      a new JVM object with the pre-existing native object assigned, or else null
    • getGroundNormal

      public Vec3 getGroundNormal()
      Return the normal direction at the point of contact with the supporting surface. The character is unaffected.
      Specified by:
      getGroundNormal in interface ConstCharacterBase
      Returns:
      a new direction vector (in system coordinates)
    • getGroundPosition

      public RVec3 getGroundPosition()
      Return the location of the point of contact with the supporting surface. The character is unaffected.
      Specified by:
      getGroundPosition in interface ConstCharacterBase
      Returns:
      a new location vector (in system coordinates)
    • getGroundState

      public EGroundState getGroundState()
      Return the relationship between the character and its supporting surface. The character is unaffected.
      Specified by:
      getGroundState in interface ConstCharacterBase
      Returns:
      an enum value (not null)
    • getGroundSubShapeId

      public SubShapeId getGroundSubShapeId()
      Identify the face on the supporting surface where contact is occurring. The character is unaffected.
      Specified by:
      getGroundSubShapeId in interface ConstCharacterBase
      Returns:
      a new ID
    • getGroundUserData

      public long getGroundUserData()
      Return the user data of the supporting surface. The character is unaffected.
      Specified by:
      getGroundUserData in interface ConstCharacterBase
      Returns:
      the 64-bit value
    • getGroundVelocity

      public Vec3 getGroundVelocity()
      Return the world-space velocity of the supporting surface. The character is unaffected.
      Specified by:
      getGroundVelocity in interface ConstCharacterBase
      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 interface ConstCharacterVirtual
      Returns:
      the cosine of the maximum angle, or -1 if hit reduction is disabled
    • getInnerBodyId

      public BodyId getInnerBodyId()
      Return the ID of the inner body. The character is unaffected.
      Specified by:
      getInnerBodyId in interface ConstCharacterVirtual
      Returns:
      the ID, or null if none
    • getLinearVelocity

      public Vec3 getLinearVelocity()
      Return the linear velocity of the character. The character is unaffected.
      Specified by:
      getLinearVelocity in interface ConstCharacterVirtual
      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 interface ConstCharacterVirtual
      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 interface ConstCharacterVirtual
      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:
      getMaxNumHits in interface ConstCharacterVirtual
      Returns:
      the limit (≥0)
    • getMaxStrength

      public float getMaxStrength()
      Return the maximum force applied to other bodies. The character is unaffected.
      Specified by:
      getMaxStrength in interface ConstCharacterVirtual
      Returns:
      the force (in Newtons)
    • getPenetrationRecoverySpeed

      public float getPenetrationRecoverySpeed()
      Return how quickly penetration is resolved. The character is unaffected.
      Specified by:
      getPenetrationRecoverySpeed in interface ConstCharacterVirtual
      Returns:
      the resolution fraction (0=never resolved, 1=all in one update)
    • getPosition

      public RVec3 getPosition()
      Copy the location of the character. The character is unaffected.
      Specified by:
      getPosition in interface ConstCharacterVirtual
      Returns:
      a new location vector (in system coordinates)
    • getRotation

      public Quat getRotation()
      Copy the orientation of the character. The character is unaffected.
      Specified by:
      getRotation in interface ConstCharacterVirtual
      Returns:
      a new rotation quaternion (in system coordinates)
    • getShape

      public ConstShape getShape()
      Access the character's shape. The character is unaffected.
      Specified by:
      getShape in interface ConstCharacterBase
      Returns:
      a new immutable JVM object with the pre-existing native object assigned, or null if none
    • getShapeOffset

      public Vec3 getShapeOffset()
      Copy the local offset applied to the shape. The character is unaffected.
      Specified by:
      getShapeOffset in interface ConstCharacterVirtual
      Returns:
      a new offset vector (in local coordinates)
    • getUp

      public Vec3 getUp()
      Return the character's "up" direction. The character is unaffected.
      Specified by:
      getUp in interface ConstCharacterBase
      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 interface ConstCharacterVirtual
      Returns:
      the value
    • getWorldTransform

      public RMat44 getWorldTransform()
      Calculate the character's local-to-system coordinate transform. The character is unaffected.
      Specified by:
      getWorldTransform in interface ConstCharacterVirtual
      Returns:
      a new transform matrix
    • hasCollidedWith

      public boolean hasCollidedWith(ConstBodyId 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 interface ConstCharacterVirtual
      Parameters:
      bodyId - the ID of the body to test against (not null, unaffected)
      Returns:
      true if contact or collision, otherwise false
    • hasCollidedWith

      public boolean hasCollidedWith(ConstCharacterVirtual otherCharacter)
      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 interface ConstCharacterVirtual
      Parameters:
      otherCharacter - the character to test against (not null, unaffected)
      Returns:
      true if contact or collision, otherwise false
    • isSlopeTooSteep

      public boolean isSlopeTooSteep(Vec3Arg normal)
      Test whether the specified normal direction is too steep. The character is unaffected.
      Specified by:
      isSlopeTooSteep in interface ConstCharacterBase
      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:
      isSupported in interface ConstCharacterBase
      Returns:
      true if supported, otherwise false
    • saveState

      public void saveState(StateRecorder recorder)
      Save the character's state to the specified recorder.
      Specified by:
      saveState in interface ConstCharacterBase
      Parameters:
      recorder - the recorder to save to (not null)
    • getPtr

      public CharacterVirtual getPtr()
      Temporarily access the referenced CharacterVirtual.
      Specified by:
      getPtr in class Ref
      Returns:
      a new JVM object that refers to the pre-existing native object
    • toRef

      public CharacterVirtualRef toRef()
      Create a counted reference to the native CharacterVirtual.
      Specified by:
      toRef in class Ref
      Returns:
      a new JVM object with a new native object assigned