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

@@ -48,8 +48,12 @@ int dbg_freecam_available(void); // the build has the camera's patch set
void dbg_freecam_set(int on, int sticks, float speed);
void dbg_freecam_reset(void); // back to the game's view, free again from there
int dbg_freecam(int *sticks, float *speed, double pos[3]); // on or off
int dbg_freecam_flying(void); // on, with the sticks: vk_dlaa.c reads the ground's distance back for it
void dbg_freecam_ground(const float *dist, int n); // the replay's thread: view distances in the lower view, 0 sky
int dbg_freecam_flying(void); // on, with the sticks and ground avoidance: vk_dlaa.c reads the ground's distances back
void dbg_freecam_avoid_set(int on); // ground avoidance (off by default): the camera stays a metre above ground-like surfaces
int dbg_freecam_avoid(void);
// The replay's thread: nine view distances of the lower view (three rows of three, the top row first; 0 sky), with the
// tangent of half the view's vertical angle and its width over its height
void dbg_freecam_ground(const float *dist, int n, float tan_half_y, float aspect);
// Memory: values of 1, 2 or 4 bytes in the game's heap.
int dbg_search_new(uint32_t value, int size); // returns the number of places