esp::physics::CollisionGroupHelper class

A convenience class with all static functions providing an interface for customizing collision masking behavior for simulated objects.

Public static functions

static auto getMaskForGroup(CollisionGroup group) -> CollisionGroups
Get the collision mask for a group.
static auto getMaskForGroup(const std::string& groupName) -> CollisionGroups
convenience override allowing the group to be referenced by name.
static void setGroupInteractsWith(CollisionGroup groupA, CollisionGroup groupB, bool interacts)
Set groupA's collision mask to a specific interaction state with respect to groupB.
static void setMaskForGroup(CollisionGroup group, CollisionGroups mask)
Set the mask for a group defining which other groups it will interactive with.
static auto getGroup(const std::string& groupName) -> CollisionGroup
Get the collision group by its name. Must pass a valid name.
static auto getGroupName(CollisionGroup group) -> std::string
Get a collision group's configured name.
static auto setGroupName(CollisionGroup group, const std::string& newName) -> bool
Set a custom name for a collision group.
static auto getAllGroupNames() -> std::vector<std::string>
Get a list of all configured collision group names for easy iteration over groups.

Function documentation

static CollisionGroups esp::physics::CollisionGroupHelper::getMaskForGroup(CollisionGroup group)

Get the collision mask for a group.

Parameters
group The collision group being queried.
Returns The integer collision mask where each bit corresponds to the group's interaction with another group.

static void esp::physics::CollisionGroupHelper::setGroupInteractsWith(CollisionGroup groupA, CollisionGroup groupB, bool interacts)

Set groupA's collision mask to a specific interaction state with respect to groupB.

Parameters
groupA The group for which the mask will be modified.
groupB The group which will be masked.
interacts

Convenience function equivalent to setting groupB bit in groupA's mask.

static void esp::physics::CollisionGroupHelper::setMaskForGroup(CollisionGroup group, CollisionGroups mask)

Set the mask for a group defining which other groups it will interactive with.

Parameters
group The group to modify.
mask The mask to apply.

Mask check logic is two ways: AandBCollide = (GroupA & MaskB) && (GroupB & MaskA) Note: Editing default engine group (Default, Static, Kinematic, Dynamic, Robot, Noncollidable, AllFilter) behavior is discouraged.

static CollisionGroup esp::physics::CollisionGroupHelper::getGroup(const std::string& groupName)

Get the collision group by its name. Must pass a valid name.

Parameters
groupName The collision group's configured name.

static std::string esp::physics::CollisionGroupHelper::getGroupName(CollisionGroup group)

Get a collision group's configured name.

Parameters
group The collision group.
Returns The group's configured name.

static bool esp::physics::CollisionGroupHelper::setGroupName(CollisionGroup group, const std::string& newName)

Set a custom name for a collision group.

Parameters
group The collision group.
newName
Returns Whether or not the set was successful.

Fails if the desired name is already in use.

static std::vector<std::string> esp::physics::CollisionGroupHelper::getAllGroupNames()

Get a list of all configured collision group names for easy iteration over groups.

Returns List of configured group names