java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.CollisionGroup
- All Implemented Interfaces:
ConstCollisionGroup
,ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Restrict which bodies can collide.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
invalid main groupstatic final int
invalid sub-group -
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a default group.CollisionGroup
(GroupFilter filter, int groupId, int subGroupId) Instantiate a group with the specified filter and IDs.CollisionGroup
(GroupFilterTableRef filterRef, int groupId, int subGroupId) Instantiate a group with the specified filter and IDs. -
Method Summary
Modifier and TypeMethodDescriptionAccess the group filter.int
Return the main group ID.int
Return the sub-group ID.void
setGroupFilter
(GroupFilter filter) Replace the group filter.void
setGroupId
(int id) Alter the main group ID.void
setSubGroupId
(int id) Alter the sub-group ID.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Field Details
-
cInvalidGroup
public static final int cInvalidGroupinvalid main group- See Also:
-
cInvalidSubGroup
public static final int cInvalidSubGroupinvalid sub-group- See Also:
-
-
Constructor Details
-
CollisionGroup
public CollisionGroup()Instantiate a default group. -
CollisionGroup
Instantiate a group with the specified filter and IDs.- Parameters:
filter
- the collision-group filter (not null)groupId
- the main group IDsubGroupId
- the ID of the subgroup to which the body belongs
-
CollisionGroup
Instantiate a group with the specified filter and IDs.- Parameters:
filterRef
- a counted reference to the desired collision-group filter (not null)groupId
- the main group IDsubGroupId
- the ID of the subgroup to which the body belongs
-
-
Method Details
-
setGroupFilter
Replace the group filter.- Parameters:
filter
- the desired filter (not null, alias created)
-
setGroupId
public void setGroupId(int id) Alter the main group ID. (native method: SetGroupID)- Parameters:
id
- the desired ID (default=cInvalidGroup)
-
setSubGroupId
public void setSubGroupId(int id) Alter the sub-group ID. (native method: SetSubGroupID)- Parameters:
id
- the desired ID (default=cInvalidSubGroup)
-
getGroupFilter
Access the group filter.- Specified by:
getGroupFilter
in interfaceConstCollisionGroup
- Returns:
- a new JVM object with the pre-existing native object assigned, or
null
if none
-
getGroupId
public int getGroupId()Return the main group ID. The group is unaffected. (native method: GetGroupID)- Specified by:
getGroupId
in interfaceConstCollisionGroup
- Returns:
- the
GroupID
value
-
getSubGroupId
public int getSubGroupId()Return the sub-group ID. The group is unaffected. (native method: GetSubGroupID)- Specified by:
getSubGroupId
in interfaceConstCollisionGroup
- Returns:
- the
SubGroupID
value
-