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.
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:
Very little answers for this question so I will give my solution.
I created a script on the sphere that manages the Health of the car.
It is linked to a game object that has a TextMeshProUGUI component (to see in the UI the life of the player.
I put tag to all object that could potentially be walls in the game (like ramps, trees, …)
I finally use OnColisionEnter to check if the car hit a “wall” and if it did the velocity of the car. If the car velocity is very small it means we hit a wall and it stopped us. This allow us the take the ramps correctly without taking damage as we have a high velocity!
It’s not perfect as you can still take a ramp super slowly and therefore take damage but I that’s the best I could do (for now )
I didn’t do a reload scene or anything when the car “dies”! To be added later