For character controller I would use a variable that calculates the air time and then take from the player’s health when touching the ground:
var minSurviveFall : float = 2f; //the time that the player can spend in the air without taking damage
var damageForSeconds : float = 1f; //damage taken for 1 second in air (for airTime = 1)
private var _controller : CharacterController;
private var airTime : float = 0;
var playerHealth : float = 10; //you can use your own variable here, or make a reference to a variable in other script
function Start () {
_controller = GetComponent(CharacterController);
}
function Update() {
if(!_controller .isGrounded)
{
airTime += Time.deltaTime;
}
if(_controller .isGrounded)
{
if(airTime > minSurviveFall)
{
playerHealth -= damageForSeconds * airTime;
}
airTime = 0;
}
}
Hi I know this is an old post but incase someone new comes along like I did I have posted a video with a project download link to a heavily extended first person controller