Make a fruit fall from a tree, bounce a few times and then lie still
Shaking a tree should drop fruit that hits the ground and hops. With a naive bounce the fruit keeps trembling on the ground forever with tiny hops, or sinks into the floor, or never settles at all. Here is a bounce with a clear end that is exact at any frame rate.
Why this works
Every bounce keeps a fixed share of the speed, so each hop is smaller and shorter than the last and the whole thing must end. Knowing the end in advance means no jitter at the floor and the same result on any device.
When not to use it
Not when the fruit can be pushed, rolls down a slope or hits other things on the way. A fixed fall only knows the straight drop to flat ground, so let a real physics step run there.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 42 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Make a fruit fall from a tree, bounce a few times and then lie still" (read_entry dropped-fruit-bounces-a-few-times-and-comes-to-rest) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP