Interface ConstContact
- All Superinterfaces:
Comparable<ConstJoltPhysicsObject>,ConstJoltPhysicsObject
- All Known Implementing Classes:
Contact
Read-only access to a
Contact. (native type: const Contact)-
Method Summary
Modifier and TypeMethodDescriptiongetBodyB()Return the ID of the colliding body.booleanTest whether the velocity of the contact point can push the character.Return the colliding character.Return the contact normal.floatReturn the contact separation.floatReturn the fraction along the path where the contact takes place.booleanTest whether the character has actually collided.booleanTest whether the colliding object is a sensor.Return the velocity of the contact point.Return the motion type of the colliding object.Return the location where the contact occurs.Return the subshape ID of the colliding body.Return the surface normal of the contact.longReturn the user data of the colliding object.booleanTest whether the contact was discarded by the contact-validate callback.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, va
-
Method Details
-
getBodyB
BodyId getBodyB()Return the ID of the colliding body. The contact is unaffected.- Returns:
- a new ID, or null if no colliding body
-
getCanPushCharacter
boolean getCanPushCharacter()Test whether the velocity of the contact point can push the character. The contact is unaffected.- Returns:
- true if can push, otherwise false
-
getCharacterB
CharacterVirtual getCharacterB()Return the colliding character. The contact is unaffected.- Returns:
- a new JVM object with the pre-existing native object assigned, or null if no colliding character
-
getContactNormal
Vec3 getContactNormal()Return the contact normal. The contact is unaffected.- Returns:
- a new direction vector, pointing toward the character
-
getDistance
float getDistance()Return the contact separation. The contact is unaffected.- Returns:
- the signed distance (in meters, ≤0→actual contact, >0→predictive contact)
-
getFraction
float getFraction()Return the fraction along the path where the contact takes place. The contact is unaffected.- Returns:
- the fraction
-
getHadCollision
boolean getHadCollision()Test whether the character has actually collided. The contact is unaffected.- Returns:
- true if a real collision, false for a predictive contact that never became a real one
-
getIsSensorB
boolean getIsSensorB()Test whether the colliding object is a sensor. The contact is unaffected.- Returns:
- true for a sensor, otherwise false
-
getLinearVelocity
Vec3 getLinearVelocity()Return the velocity of the contact point. The contact is unaffected.- Returns:
- a new velocity vector
-
getMotionTypeB
EMotionType getMotionTypeB()Return the motion type of the colliding object. The contact is unaffected.- Returns:
- an enum value (not null)
-
getPosition
RVec3 getPosition()Return the location where the contact occurs. The contact is unaffected.- Returns:
- a new vector (in system coordinates)
-
getSubShapeIdB
SubShapeId getSubShapeIdB()Return the subshape ID of the colliding body. The contact is unaffected.- Returns:
- a new ID, or null if no colliding body
-
getSurfaceNormal
Vec3 getSurfaceNormal()Return the surface normal of the contact. The contact is unaffected.- Returns:
- a new direction vector
-
getUserData
long getUserData()Return the user data of the colliding object. The contact is unaffected.- Returns:
- the data value
-
getWasDiscarded
boolean getWasDiscarded()Test whether the contact was discarded by the contact-validate callback. The contact is unaffected.- Returns:
- true if discarded, otherwise false
-