Make a boat or float ride the waves and tilt with the slope
A float that only moves up and down looks glued to the water, and one that follows the wave height at a single point never tilts. Here is how to build a rolling sea from a few waves and make a boat follow both the height and the slope at its own length.
Why this works
A floating thing just follows the water under it. If the sea is described by one rule that gives its height anywhere, the boat can read the water at two points and take the average for its height and the difference for its tilt, so it always agrees with the picture.
When not to use it
Wrong for a flat lake or a side view where the water is a painted strip, and for boats that must stay level, like a ferry in a puzzle game. Draw the water and the boat as one fixed picture there.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 29 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 boat or float ride the waves and tilt with the slope" (read_entry boat-tilts-and-rises-with-the-waves) 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