This documentation is for a prerelease version of O3DE. Click here to switch to the latest release, or select a version from the dropdown.

Version:

PhysX Shape Collider Component

The PhysX Shape Collider component adds PhysX collider based on a Shape component so that the entity can be included in PhysX simulation. The PhysX Shape Collider component can also define a trigger area or a force region.

Note:
Add a PhysX Static Rigid Body component with a PhysX Shape Collider component to create a static entity that will never move. Add a PhysX Dynamic Rigid Body component to create a simulated or a kinematic entity. Simulated entities move in response to collisions and forces. Kinematic entities aren’t affected by collisions or forces, but are driven by scripted movement.

Provider

PhysX Gem

Dependencies

The PhysX Shape Collider requires one of the following Shape components:

Use cases

Although the PhysX Shape Collider is similar to the PhysX Primitive Collider component, you might prefer to use the PhysX Shape Collider in these scenarios:

  • The shape information defined by the Shape component is used elsewhere in code or script. For example, the shape defines another volume, such as an audio volume, and you want to keep the collider geometry and volume synchronized.
  • You want to use a Shape component such as Polygon Prism Shape that is not provided by PhysX Primitive Collider.
  • You have existing Shape components and don’t want to migrate them to use PhysX Primitive Collider components.

Limitations

The PhysX Shape Collider component has some limitations compared to the PhysX Primitive Collider component:

  • Only one Shape component can be used per entity, and so only one PhysX Shape Collider component is supported per entity. Any number of PhysX Primitive Collider components can also be used on the same entity, however.
  • The position and rotation of the PhysX Shape Collider component can’t be offset relative to the entity position.

Properties

PhysX Shape Collider component interface

PropertyDescriptionValueDefault
Collision LayerAssigns the collider to a collision layer. Collision layers can be used to restrict physical interactions between PhysX objects.Any collision layer defined in the project’s Collision Layers.Default
Collides WithAssigns the collider to a collision group. Collision groups contain the collision layers that this collider can collide with.Any collision group defined in the project’s Collision Groups.All
TriggerIf enabled, this collider functions as a trigger. Triggers perform quick overlap tests with other colliders. Triggers don’t apply forces or return contact point information. Use this to speed up PhysX computations in which a simple overlap test between colliders is sufficient. Triangle meshes and Quad Shapes are not supported as triggers.BooleanDisabled
SimulatedIf enabled, this collider is included in the physics simulation.BooleanEnabled
In Scene QueriesIf enabled, this collider can be queried for raycasts, shapecasts, and overlap.BooleanEnabled
Physics MaterialsChoose a physics material for each material of this collider. Physics materials define physical properties for the surface such as dynamic and static friction, and density. A collider can have multiple physics materials assigned.A .physxmaterial asset assigned.(default)
TagSets a tag for this collider. Tags can be used to quickly identify components in script or code.StringNone
Rest offsetSets the minimum distance between this collider and other colliders. Although this property applies to all colliders, it is particularly important for dynamic colliders. Dynamic colliders are at rest when the forces affecting them drop below the Sleep threshold of their rigid body component. When a dynamic collider comes to rest while in contact with any other collider, the colliders are separated by the sum of their Rest offset values. Rest offset values that are too large might make dynamic entities appear to float. Negative Rest offset values might make dynamic entities appear to intersect. You might need to adjust this value in scenarios where the collider does not closely match the render mesh of the entity. The Rest offset value must be less than the Contact offset value.Float: -Infinity to 50.00.0
Contact offsetSets the distance from the collider where collisions are detected. PhysX bodies generate contacts when they are within the sum of their Contact offset values. The Contact offset value must be greater than the Rest offset value.Float: 0.0 to 50.00.02
Draw ColliderRender the collider in the viewport.BooleanEnabled

Complex polygon prism shapes

The Polygon Prism Shape is automatically subdivided into convex portions, which means that polygon prisms can be used with dynamic rigid bodies or as triggers in PhysX simulations. The subdivision is automatically updated if the vertices of the polygon prism are modified.

A complex polygon prism can’t be converted to convex geometry.

If the vertices are modified so that the polygon prism is no longer a simple polygon, it isn’t possible to subdivide the polygon prism into convex pieces. If the polygon prism can’t be subdivided into convex pieces, an error will display in the O3DE Editor Console, as shown in the following example.

A complex polygon prism console error.

Colliders as triggers

Triggers allow colliders to perform efficient overlap tests. Colliders marked as triggers won’t be affected by forces when they intersect with another collider. This is useful for detecting when something enters a certain area or when two objects overlap. Use Lua or Script Canvas to detect overlap.

Note:
Because triggers don’t perform contact resolution, the contact points between a trigger and another collider aren’t available. Triangle meshes and Quad Shapes are not supported as triggers.