FORUMS: list search recent posts

Bouncing Ball Expression

FAQ   •   VIEW ALL
 Bouncing Ball Expression on Dec 4, 2013 at 5:48:09 pm

Hey guys,
If got a litte problem with the bouncing-ball expression by Dan Ebberts.
A Ball gets shot with a defined velocity(v) and a Launch angle (elev). When it hits the floor, it bounces several times before it reaches its end-position.
I want to define a floor which the ball uses for bouncing after it got "shot". This floor has to sit lower than the start position
I´m sure this issue can be fixed with a just a little extra code but I don`t get it.

Here´s the expression:

``` elev = degreesToRadians(75); //launch angle v = 1900; // velocity e = .7; //elasticity f = .5; // friction g = 5000; //gravity nMax = 9; // maximum number of bounces tLaunch = 1; // Launch-time vy = v*Math.sin(elev); vx = v*Math.cos(elev); if (time >= tLaunch){ t = time - tLaunch; tCur = 0; segDur = 2*vy/g; tNext = segDur; d = 0; // x distance traveled nb = 0; // number of bounces while (tNext < t && nb <= nMax){ d += vx*segDur; vy *= e; vx *= f; segDur *= e; tCur = tNext; tNext += segDur; nb++ } if(nb <= nMax){ delta = t - tCur; x = d + delta*vx; y = delta*(vy - g*delta/2); }else{ x = d; y = 0; } value + [x,-y] }else value ```

 Re: Bouncing Ball Expressionon Dec 4, 2013 at 6:48:51 pm

Dan reads and posts in the Expressions Forum all the time, you might want to post over there...

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.