java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.ContactKey
- All Implemented Interfaces:
ConstContactKey,ConstJoltPhysicsObject,AutoCloseable,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
Contact
Identify a contact between a virtual character and a body or another virtual
character. (native type:
CharacterVirtual::ContactKey)-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a default key.ContactKey(char idType, int bodyOrCharacterId, int subShapeId) Instantiate a key with the specified parameters.ContactKey(ContactKey original) Instantiate a copy of the specified key. -
Method Summary
Modifier and TypeMethodDescriptionintgetBodyB()Return the ID of the colliding body.intReturn the ID of the colliding character.intReturn the sub-shape ID of the colliding body.booleanisEqual(ConstContactKey other) Test for equivalence with another key.booleanisNotEqual(ConstContactKey other) Test for equivalence with another key.voidrestoreState(StateRecorder recorder) Restore the key from the specified recorder.voidsaveState(StateRecorder recorder) Save the key to the specified recorder.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, 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, targetVa
-
Constructor Details
-
ContactKey
public ContactKey()Instantiate a default key. -
ContactKey
Instantiate a copy of the specified key.- Parameters:
original- the settings to copy (notnull, unaffected)
-
ContactKey
public ContactKey(char idType, int bodyOrCharacterId, int subShapeId) Instantiate a key with the specified parameters.- Parameters:
idType- "b" for body or "c" for characterbodyOrCharacterId- theBodyIDorCharacterIDof the other colliding objectsubShapeId- theSubShapeIDof the shape that is in contact
-
-
Method Details
-
restoreState
Restore the key from the specified recorder.- Parameters:
recorder- the recorder to restore from (notnull)
-
getBodyB
public int getBodyB()Return the ID of the colliding body. The key is unaffected. (native attribute: mBodyB)- Specified by:
getBodyBin interfaceConstContactKey- Returns:
- the
BodyIDvalue
-
getCharacterIdB
public int getCharacterIdB()Return the ID of the colliding character. The key is unaffected. (native attribute: mCharacterIDB)- Specified by:
getCharacterIdBin interfaceConstContactKey- Returns:
- the
CharacterIDvalue
-
getSubShapeIdB
public int getSubShapeIdB()Return the sub-shape ID of the colliding body. The contact is unaffected. (native attribute: mSubShapeIDB)- Specified by:
getSubShapeIdBin interfaceConstContactKey- Returns:
- a
SubShapeIDvalue (typically negative)
-
isEqual
Test for equivalence with another key. The key is unaffected. (native operator: binary==)- Specified by:
isEqualin interfaceConstContactKey- Parameters:
other- the key to compare with (notnull, unaffected)- Returns:
trueif equivalent, otherwisefalse
-
isNotEqual
Test for equivalence with another key. The key is unaffected.(native operator: binary!=)- Specified by:
isNotEqualin interfaceConstContactKey- Parameters:
other- the key to compare with (notnull, unaffected)- Returns:
falseif equivalent, otherwisetrue
-
saveState
Save the key to the specified recorder. The key is unaffected.- Specified by:
saveStatein interfaceConstContactKey- Parameters:
recorder- the recorder to save to (notnull)
-