Version:

PhysX Collision Layers

With collision layers, you can place related PhysX entities into categories. The following list demonstrates some example PhysX collision layers:

  • Terrain - Terrain, flooring, and any entities that player entities can traverse.
  • Static objects - Entities that have colliders and static rigid body components, but no animation, such as large rocks, tree trunks, and walls.
  • Players - All player controlled entities.
  • Enemies - Entities that move via script or AI that can deal damage to, and receive damage from, player controlled entities.
  • Projectiles - Entities that can deal damage.

A project can have up to 64 PhysX collision layers. The layers that you define are specific to your project. When a PhysX Collider component is added to an entity, it is assigned a collision layer with index [0] called Default. You can assign each collider component to one layer. An entity can have multiple collider components assigned to different layers.

Create a collision layer

  1. In O3DE Editor, from the Tools menu, choose PhysX Configuration.

  2. Choose the Collision Filtering tab.

  3. Click the Layers button to view the layers list.

  4. Type the name of the layer into an available text field. Layer names must be 32 characters or less.

    Creating Layers in the PhysX Configuration tool.

Collision layer assignment

  1. In O3DE Editor, select an entity with a PhysX Collider component you’d like to assign to a collision layer.

  2. In the PhysX Collider component, from the Collision Layer property, choose one of the available collision layers from the drop-down list.

    The PhysX Collider component in the Entity Inspector.

Note:
  • If you rename a layer, its references are updated automatically.
  • Layers can’t be reordered.
  • If you create, rename, or delete a collision layer while an entity with a collider assigned to the layer is selected, the changes don’t appear in the Entity Inspector. To see the changes, deselect and reselect the entity to refresh the component interface.