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 intinvalid main groupstatic final intinvalid 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.intReturn the main group ID.intReturn the sub-group ID.voidsetGroupFilter(GroupFilter filter) Replace the group filter.voidsetGroupId(int id) Alter the main group ID.voidsetSubGroupId(int id) Alter the sub-group ID.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
-
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 function: SetGroupID)- Parameters:
id- the desired ID (default=cInvalidGroup)
-
setSubGroupId
public void setSubGroupId(int id) Alter the sub-group ID. (native function: SetSubGroupID)- Parameters:
id- the desired ID (default=cInvalidSubGroup)
-
getGroupFilter
Access the group filter.- Specified by:
getGroupFilterin interfaceConstCollisionGroup- Returns:
- a new JVM object with the pre-existing native object assigned, or
nullif none
-
getGroupId
public int getGroupId()Return the main group ID. The group is unaffected. (native function: GetGroupID)- Specified by:
getGroupIdin interfaceConstCollisionGroup- Returns:
- the
GroupIDvalue
-
getSubGroupId
public int getSubGroupId()Return the sub-group ID. The group is unaffected. (native function: GetSubGroupID)- Specified by:
getSubGroupIdin interfaceConstCollisionGroup- Returns:
- the
SubGroupIDvalue
-