DRIFT DRIVING QUEST: ‘Damage System' - Solutions

Quest: Drift Driving Quest
Challenge: Damage System

Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.

I solved this with the following:

  1. Added a new Health Script attached to the CarSphere that contained this code:
    void OnTriggerEnter(Collider other)
    {
    if(other.tag == “Damage”)
    {
    hitPoints += -5;
    print(hitPoints);
    }
    }
  2. Added a new Sphere Collider to the CarSphere and clicked on the IsTrigger.
  3. Added a new tag called “Damage” and added this tag to the outer walls and a few other objects.