- Home /
How to implement fall damage
In my game, I'd like to have character lose his health when fall from too high. How to make such fall damage?
@Lovrenc $$anonymous$$ight I recommend making that an answer ins$$anonymous$$d of a comment, it seems pretty explanatory and inclusive to me.
Answer by Lovrenc · Dec 30, 2012 at 04:26 PM
Depends how you are controlling your character. If you have gravity on him you can easily use vertical speed to determine on collision event wheather vertical velocity is greater than lets say 5m/s and he should get damage.
Even if you have custom controls this would apply.
If you dont have those variables you could raycast and if you hit nothing for lets say 4meters below player, you raise a flag "dieOnCollision" or whatever and than update player status accordingly when you have collision from above.
Thanks. I think I will just use raycast method, since it is simplest one.
Your answer
Follow this Question
Related Questions
Falling Damage 1 Answer
Health Regeneration 2 Answers
Enemy Health, Player Damage 0 Answers
fall damage issue? 2 Answers
Damage/Health problem 2 Answers