Interface CharacterContactListener

All Superinterfaces:
AutoCloseable, Comparable<JoltPhysicsObject>, ConstJoltPhysicsObject
All Known Implementing Classes:
CustomCharacterContactListener

public interface CharacterContactListener extends ConstJoltPhysicsObject
Receive callbacks when a virtual character collides with something.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onAdjustBodyVelocity(long characterVa, long body2Va, float[] velocities)
    Callback invoked (by native code) to adjust the velocity of the specified body as seen by the specified character.
    void
    onCharacterContactAdded(long characterVa, long otherCharacterVa, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
    Callback invoked (by native code) whenever 2 characters collide.
    void
    onCharacterContactPersisted(long characterVa, long otherCharacterVa, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
    Callback invoked (by native code) whenever a contact between 2 characters becomes persistent.
    void
    onCharacterContactRemoved(long characterVa, int otherCharacterId, int subShapeId2)
    Callback invoked (by native code) whenever a contact between 2 characters is destroyed.
    void
    onCharacterContactSolve(long characterVa, long otherCharacterVa, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, float contactVelocityX, float contactVelocityY, float contactVelocityZ, long materialVa, float characterVelocityX, float characterVelocityY, float characterVelocityZ, float[] newCharacterVelocity)
    Callback invoked (by native code) whenever a character-versus-character contact is being solved.
    boolean
    onCharacterContactValidate(long characterVa, long otherCharacterVa, int subShapeId2)
    Callback invoked (by native code) to test whether the specified characters can collide.
    void
    onContactAdded(long characterVa, int bodyId2, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
    Callback invoked (by native code) whenever a character collides with a body.
    void
    onContactPersisted(long characterVa, int bodyId2, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
    Callback invoked (by native code) whenever a contact between a character and a body becomes persistent.
    void
    onContactRemoved(long characterVa, int bodyId2, int subShapeId2)
    Callback invoked (by native code) whenever a contact between a character and a body is destroyed.
    void
    onContactSolve(long characterVa, int bodyId2, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, float contactVelocityX, float contactVelocityY, float contactVelocityZ, long materialVa, float characterVelocityX, float characterVelocityY, float characterVelocityZ, float[] newCharacterVelocity)
    Callback invoked (by native code) whenever a character-versus-body contact is being solved.
    boolean
    onContactValidate(long characterVa, int bodyId2, int subShapeId2)
    Callback invoked (by native code) to test whether the specified character can collide with the specified body.

    Methods inherited from interface java.lang.Comparable

    compareTo

    Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject

    close, hasAssignedNativeObject, ownsNativeObject, targetVa
  • Method Details

    • onAdjustBodyVelocity

      void onAdjustBodyVelocity(long characterVa, long body2Va, float[] velocities)
      Callback invoked (by native code) to adjust the velocity of the specified body as seen by the specified character.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual (not zero)
      body2Va - the virtual address of the Body (not zero)
      velocities - the components of the linear and angular velocities (length≥6, may be modified)
    • onCharacterContactAdded

      void onCharacterContactAdded(long characterVa, long otherCharacterVa, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
      Callback invoked (by native code) whenever 2 characters collide.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      otherCharacterVa - the virtual address of the other CharacterVirtual (not zero)
      subShapeId2 - the SubShapeID of the shape that is in contact
      contactLocationX - the X component of the contact location (in system coordinates)
      contactLocationY - the Y component of the contact location (in system coordinates)
      contactLocationZ - the Z component of the contact location (in system coordinates)
      contactNormalX - the X component of the contact normal (in system coordinates)
      contactNormalY - the Y component of the contact normal (in system coordinates)
      contactNormalZ - the Z component of the contact normal (in system coordinates)
      settingsVa - the virtual address of the CharacterContactSettings for storing the desired behavior
    • onCharacterContactPersisted

      void onCharacterContactPersisted(long characterVa, long otherCharacterVa, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
      Callback invoked (by native code) whenever a contact between 2 characters becomes persistent.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      otherCharacterVa - the virtual address of the other CharacterVirtual (not zero)
      subShapeId2 - the SubShapeID of the shape that is in contact
      contactLocationX - the X component of the contact location (in system coordinates)
      contactLocationY - the Y component of the contact location (in system coordinates)
      contactLocationZ - the Z component of the contact location (in system coordinates)
      contactNormalX - the X component of the contact normal (in system coordinates)
      contactNormalY - the Y component of the contact normal (in system coordinates)
      contactNormalZ - the Z component of the contact normal (in system coordinates)
      settingsVa - the virtual address of the CharacterContactSettings for storing the desired behavior
    • onCharacterContactRemoved

      void onCharacterContactRemoved(long characterVa, int otherCharacterId, int subShapeId2)
      Callback invoked (by native code) whenever a contact between 2 characters is destroyed.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      otherCharacterId - the other character's ID
      subShapeId2 - the SubShapeID of the shape that is in contact
    • onCharacterContactSolve

      void onCharacterContactSolve(long characterVa, long otherCharacterVa, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, float contactVelocityX, float contactVelocityY, float contactVelocityZ, long materialVa, float characterVelocityX, float characterVelocityY, float characterVelocityZ, float[] newCharacterVelocity)
      Callback invoked (by native code) whenever a character-versus-character contact is being solved.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      otherCharacterVa - the virtual address of the other CharacterVirtual (not zero)
      subShapeId2 - the SubShapeID of the shape that is in contact
      contactLocationX - the X component of the contact location (in system coordinates)
      contactLocationY - the Y component of the contact location (in system coordinates)
      contactLocationZ - the Z component of the contact location (in system coordinates)
      contactNormalX - the X component of the contact normal (in system coordinates)
      contactNormalY - the Y component of the contact normal (in system coordinates)
      contactNormalZ - the Z component of the contact normal (in system coordinates)
      contactVelocityX - the X component of the velocity of the contact point (meters per second in system coordinates)
      contactVelocityY - the Y component of the velocity of the contact point (meters per second in system coordinates)
      contactVelocityZ - the Z component of the velocity of the contact point (meters per second in system coordinates)
      materialVa - the virtual address of the PhysicsMaterial at the contact point (not zero)
      characterVelocityX - the X component of the character's prior velocity (in system coordinates)
      characterVelocityY - the Y component of the character's prior velocity (in system coordinates)
      characterVelocityZ - the Z component of the character's prior velocity (in system coordinates)
      newCharacterVelocity - storage for the new velocity vector (in system coordinates, length≥3)
    • onCharacterContactValidate

      boolean onCharacterContactValidate(long characterVa, long otherCharacterVa, int subShapeId2)
      Callback invoked (by native code) to test whether the specified characters can collide.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      otherCharacterVa - the virtual address of the other CharacterVirtual (not zero)
      subShapeId2 - the SubShapeID of the shape that is in contact
      Returns:
      true if the contact is valid, otherwise false
    • onContactAdded

      void onContactAdded(long characterVa, int bodyId2, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
      Callback invoked (by native code) whenever a character collides with a body.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      bodyId2 - the ID of the body being solved
      subShapeId2 - the SubShapeID of the shape that is in contact
      contactLocationX - the X component of the contact location (in system coordinates)
      contactLocationY - the Y component of the contact location (in system coordinates)
      contactLocationZ - the Z component of the contact location (in system coordinates)
      contactNormalX - the X component of the contact normal (in system coordinates)
      contactNormalY - the Y component of the contact normal (in system coordinates)
      contactNormalZ - the Z component of the contact normal (in system coordinates)
      settingsVa - the virtual address of the CharacterContactSettings for storing the desired behavior
    • onContactPersisted

      void onContactPersisted(long characterVa, int bodyId2, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, long settingsVa)
      Callback invoked (by native code) whenever a contact between a character and a body becomes persistent.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      bodyId2 - the ID of the body being solved
      subShapeId2 - the SubShapeID of the shape that is in contact
      contactLocationX - the X component of the contact location (in system coordinates)
      contactLocationY - the Y component of the contact location (in system coordinates)
      contactLocationZ - the Z component of the contact location (in system coordinates)
      contactNormalX - the X component of the contact normal (in system coordinates)
      contactNormalY - the Y component of the contact normal (in system coordinates)
      contactNormalZ - the Z component of the contact normal (in system coordinates)
      settingsVa - the virtual address of the CharacterContactSettings for storing the desired behavior
    • onContactRemoved

      void onContactRemoved(long characterVa, int bodyId2, int subShapeId2)
      Callback invoked (by native code) whenever a contact between a character and a body is destroyed.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      bodyId2 - the ID of the body being solved
      subShapeId2 - the SubShapeID of the shape that is in contact
    • onContactSolve

      void onContactSolve(long characterVa, int bodyId2, int subShapeId2, double contactLocationX, double contactLocationY, double contactLocationZ, float contactNormalX, float contactNormalY, float contactNormalZ, float contactVelocityX, float contactVelocityY, float contactVelocityZ, long materialVa, float characterVelocityX, float characterVelocityY, float characterVelocityZ, float[] newCharacterVelocity)
      Callback invoked (by native code) whenever a character-versus-body contact is being solved.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      bodyId2 - the ID of the body being solved
      subShapeId2 - the SubShapeID of the shape that is in contact
      contactLocationX - the X component of the contact location (in system coordinates)
      contactLocationY - the Y component of the contact location (in system coordinates)
      contactLocationZ - the Z component of the contact location (in system coordinates)
      contactNormalX - the X component of the contact normal (in system coordinates)
      contactNormalY - the Y component of the contact normal (in system coordinates)
      contactNormalZ - the Z component of the contact normal (in system coordinates)
      contactVelocityX - the X component of the velocity of the contact point (meters per second in system coordinates)
      contactVelocityY - the Y component of the velocity of the contact point (meters per second in system coordinates)
      contactVelocityZ - the Z component of the velocity of the contact point (meters per second in system coordinates)
      materialVa - the virtual address of the PhysicsMaterial at the contact point (not zero)
      characterVelocityX - the X component of the character's prior velocity (meters per second in system coordinates)
      characterVelocityY - the Y component of the character's prior velocity (meters per second in system coordinates)
      characterVelocityZ - the Z component of the character's prior velocity (meters per second in system coordinates)
      newCharacterVelocity - storage for the new velocity vector (in system coordinates, length≥3)
    • onContactValidate

      boolean onContactValidate(long characterVa, int bodyId2, int subShapeId2)
      Callback invoked (by native code) to test whether the specified character can collide with the specified body.
      Parameters:
      characterVa - the virtual address of the CharacterVirtual being solved (not zero)
      bodyId2 - the ID of the body being solved
      subShapeId2 - the SubShapeID of the shape that is in contact (not zero)
      Returns:
      true if the contact is valid, otherwise false