Interface ConstContact
- All Superinterfaces:
Comparable<JoltPhysicsObject>
,ConstJoltPhysicsObject
- All Known Implementing Classes:
Contact
Read-only access to a
Contact
. (native type: const Contact)-
Method Summary
Modifier and TypeMethodDescriptionint
getBodyB()
Return the ID of the colliding body.boolean
Test whether the velocity of the contact point can push the character.Return the colliding character.Copy the contact normal.float
Return the contact separation.float
Return the fraction along the path where the contact takes place.boolean
Test whether the character has actually collided.boolean
Test whether the colliding object is a sensor.Copy the velocity of the contact point.Return the motion type of the colliding object.Copy the location where the contact occurs.int
Return the sub-shape ID of the colliding body.Copy the surface normal of the contact.long
Return the user data of the colliding object.boolean
Test whether the contact was discarded by the contact-validate callback.Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
getBodyB
int getBodyB()Return the ID of the colliding body. The contact is unaffected.- Returns:
- the
BodyID
value
-
getCanPushCharacter
boolean getCanPushCharacter()Test whether the velocity of the contact point can push the character. The contact is unaffected.- Returns:
true
if can push, otherwisefalse
-
getCharacterB
ConstCharacterVirtual 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()Copy 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, otherwisefalse
-
getLinearVelocity
Vec3 getLinearVelocity()Copy 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()Copy the location where the contact occurs. The contact is unaffected.- Returns:
- a new vector (in system coordinates)
-
getSubShapeIdB
int getSubShapeIdB()Return the sub-shape ID of the colliding body. The contact is unaffected.- Returns:
- a
SubShapeID
value
-
getSurfaceNormal
Vec3 getSurfaceNormal()Copy 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, otherwisefalse
-