[Haskell-cafe] Netwire bouncing ball
Just
haskell at justnothing.org
Thu Jul 11 18:52:45 CEST 2013
On 07/10/2013 11:44 PM, Ertugrul Söylemez wrote:
> A very simple way to do this is to use integralLim_ instead of
> integral_. It allows the ball itself to handle the bouncing. A less
> invasive way (i.e. you can add it to your example) is to use the (-->)
> combinator:
>
> ball = integral_ 0 . integral_ 40 . (-9.8)
>
> aboveGround = require (>= 0)
>
> bouncingBall = aboveGround . ball --> bouncingBall
>
> While this gives you a bouncing ball, the ball will not follow real
> physics. Once the ball hits the ground, it will just start over with
> its original velocity. integralLim_ is the correct solution.
Thank you very much, this works as expected and is easy to understand.
However a complete example of a bouncing ball would be super awesome
since I have trouble to get it work with integralLim_.
My first try was to use object_ from Control.Wire.Prefab.Move but got
stuck very quickly.
I think this would be a good addition to the quickstart tutorial.
More information about the Haskell-Cafe
mailing list