- Home /
Question by
poncegabby0 · Apr 17, 2021 at 08:14 AM ·
timejumpingcalculation
I would like to calculate for Air time.
I would like to get the time starting from when I left the ground which I can check with my isGrounded bool, to when I touch the floor again so that I will be able to stop the jumping animation when I touch the floor instead of using the invoke method.
Comment
Answer by Darkluca · Apr 18, 2021 at 12:31 AM
public float airDuration;
Update()
{
if(isGrounded == false)
{
airDuration += Time.deltaTime;
Debug.Log(airDuration);
}
else
{
airDuration = Time.deltaTime; // or zero
}
}
Untested.
Your answer
![](https://koobas.hobune.stream/wayback/20220613032426im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Lerp - Time Remaining 1 Answer
Need help affecting 2d jump with UnscaledDeltatime 0 Answers
When is Velocity calculated? 1 Answer
Have a delay after each jump, so user cant spam jump 3 Answers
Digital Clock: Time.time > 60 2 Answers