After turning the view, the forward key moves the camera sideways
In a 3D map view the player can turn around and keep scrolling, and the keys should still mean forward, back, left and right as seen on the screen. Using the map's own axes breaks this after the first turn. Here is the small rotation that fixes it and how the speed should depend on height.
Why this works
A key means a direction as the player sees it, and the player sees the screen, not the compass. So the key press has to be turned by the way the camera faces, and only along the ground, or a steep view would make the same key feel slow.
When not to use it
Skip it when the screen never turns, such as a fixed side or top-down view, where the keys can simply mean north, south, east and west. It also fits badly with a camera that follows a character, which should steer by the character.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 31 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 "After turning the view, the forward key moves the camera sideways" (read_entry strategy-pan-relative-to-view-direction) 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