Skip to content

11 UFO Collision

Russ Painter edited this page Jan 26, 2019 · 3 revisions

While we're on the topic of colliders, let's do the same thing for the UFO prefab. Note these changes should be done on the outermost UFO prefab game object, not the model.

Rigidbody

  1. Select the UFO prefab in prefab mode.

  2. Add a Rigidbody component.

  3. Un-check Use Gravity to prevent the UFOs just dropping onto the ground.

  4. In Constraints check Freeze Rotation for X and Z. This will keep our UFO level with the ground even after an impact.

Colliders

  1. Add a Sphere Collider and position this to line up with the dome/cockpit.

  2. Add a Mesh Collider. This is going the be the collider for the main body of the UFO.

  3. On the Mesh Collider check Convex and for the Mesh value select UFO_body.

UFO Colliders

If you play the game now, the player ship should bounce off of the UFOs rather than just pass through them. We'll worry about dealing with the collisions in a later step.

Clone this wiki locally