We will now add a custom layer to the obstacles object:
- To add a new layer, we will navigate to Edit | Project Settings | Tags:
- Assign the name Obstacles to User Layer 8.
- We then go back to our cube entity and set its layer property to Obstacles:
- When we use raycasting to detect obstacles, we check for those entities, but only on this particular layer. This way, the physics system can ignore objects hit by a ray that are not obstacles, such as bushes or vegetation: