Collider Rules
Introduction
Colliders are crucial for detecting overlaps and collisions in game development. Axis components use them to manage different behaviors, simplifying the organization, setup and visualization of interactions field.
NavmeshMatrix Grid Generation
Colliders are essential for the Axis grid generation system. Grids are generated using the NavmeshMatrix component, which relies on the colliders of its child GameObjects.
In Axis, the NavmeshMatrix object is crucial for grid generation within your game. It uses all colliders within its hierarchy to shape the grid. These colliders can either be triggers or solids:
Trigger Colliders: These create passable tiles, allowing characters or objects to move through them from below. They're useful for designing platforms where players can jump through.
Non-Trigger Colliders: These generate solid surface tiles, which act as barriers or obstacles that characters or objects can only walk over their surface. These are used for walls, ramps, and creating limited height tunnels.
NavZones
NavZone objects in Axis follow specific rules for determining which tiles are included in the NavZone group and receive its properties and triggers. These rules depend on whether the NavZone's collider is set as a trigger or not.
Trigger Collider: When a NavZone collider is set to trigger, all tiles that fall within the collider's bounds will belong to the NavZone group. These tiles will receive the properties and triggers associated with the NavZone.
Non-Trigger Collider: When the collider is solid (non-trigger), it will only include the tiles generated directly over its surface within the Navmesh Matrix grid parent. This means the solid collider's influence is limited to the tiles that are part of the Navmesh Matrix during grid generation.
Here's a summary:
NavZone | Behavior |
---|---|
Trigger | All tiles inside the collider belong to the NavZone group and receive its properties and triggers. |
Solid | Only tiles generated over the solid collider are included in the NavZone group, within the Navmesh Matrix grid generation. |
NavObjects
In Axis, the behavior of a NavObject's collider is determined by whether it is set as a trigger or not. Here's how it works:
Trigger Collider: If the NavObject's collider is set to trigger, other objects can pass through it. Despite being passable, hitting actions and effects will affect it as if it were solid, when suitable.
Non-Trigger Collider: If the collider is not set as a trigger, it is considered solid. This means it will occupy the current tile, preventing other objects from walking through that space.
Here's a quick reference for the interactions:
Collider Moving × In The Way | Interaction Outcome |
---|---|
Trigger × Trigger | Walk through |
Trigger × Solid | Blocked |
Solid × Trigger | Walk through |
Solid × Solid | Blocked |
Targeted Action
In targeted actions that inherit from ObjActionTarget, action colliders must always be set as triggers. This setting is crucial as it allows the collider to serve as a reference for target detection within that specific region.
Spawners
The AxisSpawner component typically instantiates its children at their current absolute positions.
However, there's an exception: if the spawnable children are positioned at zero relative coordinates and the AxisSpawner has a trigger collider attached to it, the spawnable objects will be instantiated at random points within the collider's absolute bounds. This allows for more dynamic and varied spawn locations within the defined area of the collider.
Click here for more details on AxisSpawner options
NavCamera
The NavCamera component includes a property called KeepInsideCollider. This property allows you to set any collider as the boundary limits for the camera's position. When KeepInsideCollider is set, the camera will be restricted to move only within the bounds of the specified collider. This ensures that the camera stays within a defined area.