Goal collider

To detect a goal, we will add a 3D Cube game object with a collider to the basket. It will only be an invisible collider, that is, not rendered as part of the scene. We want collisions to trigger events, which we'll handle in a script:

  1. With BoxballGame selected in Hierarchy, create a new 3D Cube, named GoalCollider.
  2. Set its Transform Position to (0, 2.5, 0) and Scale (1.8, 0.05, 1.8).
  3. On its Box Collider component, check the Is Trigger checkbox.
  4. Remove its Mesh Renderer component (gear-icon | Remove Component).
  5. The following screenshot shows the scene with GoalCollider before its renderer is removed:

Get Augmented Reality for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.