Scrolling over hills makes the 3D camera dive into the ground or bounce up and down
A camera that keeps a fixed height above the ground under it follows every bump of the terrain, and one that ignores the ground goes through hills. Here is how to look at the ground around the spot instead of at one point, how fast to go up and down, and a floor that is never broken.
Why this works
Once the camera is under the ground, nothing else matters, so the safe choice is to follow the highest ground nearby. Rising quickly and sinking slowly lets the view clear a ridge in time while staying calm when the land drops.
When not to use it
Skip it on flat maps or in a strictly top-down view where the camera never nears the ground. In a game with a camera that must hug the surface, like a low chase view, follow the exact ground and accept the bumps.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 21 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 "Scrolling over hills makes the 3D camera dive into the ground or bounce up and down" (read_entry strategy-camera-height-over-hills) 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