Let the free camera go anywhere, and make ground avoidance a switch that is off unless asked for.

The camera kept its height (only ZR and ZL changed it) and rose whenever the closest surface in the lower part of the view came within about three metres, so flying up to a character, a rock or a wall sent it upwards. It now moves where it looks and nothing stops it, the ground included.

Ground avoidance is a checkbox in the debug menu's free camera section. With it on, the nine view distances read back from the lower view become points of the scene (from the view's angles and the camera's pitch), and only a column whose lowest surface rises by less than about 30 degrees counts as ground: the camera goes no lower than a metre above it. Steeper things, objects and walls, are left alone. The read-back runs only while the switch is on.

Tested on a village save, 4 m/s forward for 5 s and then ZL for 4 s: with avoidance off the camera ended 17.4 m lower, through the floor; with it on it ended 0.7 m lower and held there. Flown at Link with the first version of the ground test, its height did not change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-12 12:07:56 -05:00
parent 81e7da91aa
commit 7581bb887d
5 changed files with 98 additions and 43 deletions

View File

@@ -304,17 +304,19 @@ void tab_world(void) {
if (ImGui::RadioButton("The camera stays where it is, the pad plays the game", sticks == 0)) sticks = 0, changed = true;
ImGui::SetNextItemWidth(-1);
if (ImGui::SliderFloat("##camspeed", &cam_speed, 1.0f, 100.0f, "%.0f metres a second", ImGuiSliderFlags_Logarithmic)) changed = true;
bool avoid = dbg_freecam_avoid() != 0;
if (ImGui::Checkbox("Ground avoidance: stay a metre above the ground", &avoid)) dbg_freecam_avoid_set(avoid);
if (ImGui::Button("Back to the game's view")) dbg_freecam_reset();
ImGui::SameLine();
ImGui::TextDisabled("x %.1f y %.1f z %.1f", at[0], at[1], at[2]);
}
if (changed) dbg_freecam_set(on, sticks, cam_speed);
ImGui::TextWrapped("Close this menu to fly: the left stick moves level, ahead and sideways, the right stick turns, ZR and ZL "
"go up and down, R is four times as fast and L four times as slow. The height changes only with ZR "
"and ZL, and with DLSS, DLAA or FSR 3.1 or 4 on the camera rises where the ground ahead or below comes "
"within a few metres. The game goes on meanwhile and draws what the camera sees; the game speed above "
"slows it down. Without those upscalers it does not stop at hills: below the ground the picture shows "
"the void under the map, not a missing floor.");
ImGui::TextWrapped("Close this menu to fly: the left stick moves where the camera looks and sideways, the right stick "
"turns, ZR and ZL go up and down, R is four times as fast and L four times as slow. Nothing stops the "
"camera: it goes through walls, objects and the ground, and below the ground the picture shows the "
"void under the map, not a missing floor. With ground avoidance on (it needs DLSS, DLAA or FSR 3.1 or "
"4) it stays a metre above fields and gentle hills; objects and walls never push it. The game goes on "
"meanwhile and draws what the camera sees; the game speed above slows it down.");
}
// ---- memory