deceleration_distance

Downloaddeceleration_distance(speed,friction)   Returns the distance travelled by an object moving at the given speed with the given rate of deceleration.
/*
**  Usage:
**      deceleration_distance(speed,friction)
**
**  Arguments:
**      speed       speed, real
**      friction    deceleration rate, real
**
**  Returns:
**      the distance travelled by an object moving at the
**      the given speed with the given rate of deceleration
**
**  Notes:
**      This function has been tuned to accurately predict
**      the results of Game Maker's built-in friction physics.
**
**  GMLscripts.com
*/

{
    var s,f;
    s = argument0;
    f = argument1;
    if (f == 0) return -1 else return (s*(s-f))/(2*f);
}

Click if you've used this script[Please Login]
Projects: 6


comments powered by Disqus