Open 3D Engine AzFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzPhysics::CollisionGroups Class Reference

#include <CollisionGroups.h>

Classes

class  Id
 
struct  Preset
 

Public Member Functions

 AZ_TYPE_INFO (CollisionGroups, "{309B0B28-F51F-48E2-972E-DA7618ED7249}")
 
Id CreateGroup (const AZStd::string &name, CollisionGroup group, Id id=Id::Create(), bool readOnly=false)
 
void DeleteGroup (Id id)
 Delete a group with the given CollisionGroup::Id.
 
void SetGroupName (Id id, const AZStd::string &groupName)
 Set the name of a group with the given CollisionGroup::Id.
 
void SetLayer (Id id, CollisionLayer layer, bool enabled)
 
CollisionGroup FindGroupById (Id id) const
 
CollisionGroup FindGroupByName (const AZStd::string &groupName) const
 
bool TryFindGroupByName (const AZStd::string &groupName, CollisionGroup &group) const
 
Id FindGroupIdByName (const AZStd::string &groupName) const
 
AZStd::string FindGroupNameById (Id id) const
 
const AZStd::vector< Preset > & GetPresets () const
 Retrieve a list of all current Presets (see CollisionGroup::Preset).
 
bool operator== (const CollisionGroups &other) const
 
bool operator!= (const CollisionGroups &other) const
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Public Attributes

 AZ_CLASS_ALLOCATOR_DECL
 

Detailed Description

Collision groups can be defined and edited in the PhysXConfiguration window. The idea is that collision groups are authored there, and then assigned to components via the edit context by reflecting Physics::CollisionGroups::Id, or alternatively can be retrieved by name from the CollisionConfiguration.

Member Function Documentation

◆ CreateGroup()

Id AzPhysics::CollisionGroups::CreateGroup ( const AZStd::string &  name,
CollisionGroup  group,
Id  id = Id::Create(),
bool  readOnly = false 
)

Create a CollisionGroup.

Parameters
nameThe name to give the group.
groupThe CollisionGroup data to set to this group.
idA CollisionGroup::Id to assign to the group. By default will create a new Id.
readOnlyMark the group as read only. Default false.
Returns
Returns the CollisionGroup::Id associated with the new Group.

◆ FindGroupById()

CollisionGroup AzPhysics::CollisionGroups::FindGroupById ( Id  id) const
Parameters
idThe CollisionGroup::Id to find.
Returns
Returns the requested CollisionGroup, otherwise return CollisionGroup::All.

◆ FindGroupByName()

CollisionGroup AzPhysics::CollisionGroups::FindGroupByName ( const AZStd::string &  groupName) const
Parameters
groupNameThe CollisionGroup name to find.
Returns
Returns the requested CollisionGroup, otherwise return CollisionGroup::All.

◆ FindGroupIdByName()

Id AzPhysics::CollisionGroups::FindGroupIdByName ( const AZStd::string &  groupName) const

Retrieve the CollisionGroup::Id of the request name.

Parameters
groupNameThe name of the CollisionGroup to lookup.
Returns
Returns the request CollisionGroup::Id otherwise returns a 'null id'.

◆ FindGroupNameById()

AZStd::string AzPhysics::CollisionGroups::FindGroupNameById ( Id  id) const

Retrieve the name of the requested CollisionGroup::Id.

Parameters
idThe CollisionGroup::Id to preform a name lookup for.
Returns
The name of the CollisionGroup, otherwise returns an empty string.

◆ SetLayer()

void AzPhysics::CollisionGroups::SetLayer ( Id  id,
CollisionLayer  layer,
bool  enabled 
)

Set a CollisionLayer ON or OFF on in the given CollisionGroup::Id. This will verify id is valid.

Parameters
idThe group id to affect.
layerThe CollisionLayer to turn ON or OFF.
enabledIf true toggle the given CollisionLayer to ON, otherwise OFF

◆ TryFindGroupByName()

bool AzPhysics::CollisionGroups::TryFindGroupByName ( const AZStd::string &  groupName,
CollisionGroup group 
) const
Parameters
groupNameThe CollisionGroup name to find.
group[Out] The requested CollisionGroup if successful. Otherwise group is unchanged.
Returns
Returns true if located the requested CollisionGroup, otherwise false.

The documentation for this class was generated from the following file: