From b0549612a99595aa5c8472270211100c5f0d0519 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Mon, 6 Jan 2025 15:38:40 +0300 Subject: [PATCH] /apps/demos/scenery: lock movement direction to a plane --- apps/demos/scenery/scenes/ingame.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/demos/scenery/scenes/ingame.c b/apps/demos/scenery/scenes/ingame.c index 6d71083..a68a3d0 100644 --- a/apps/demos/scenery/scenes/ingame.c +++ b/apps/demos/scenery/scenes/ingame.c @@ -83,6 +83,9 @@ static void process_ground_mode(State *state) { DrawCameraFromPrincipalAxesResult dir_and_up = draw_camera_from_principal_axes(scn->pos, (float)M_PI_2 * 0.8f, scn->roll, scn->pitch, scn->yaw); + dir_and_up.direction.y = 0; + dir_and_up.direction = vec3_norm(dir_and_up.direction); + const Vec3 right = m_vec_norm(m_vec_cross(dir_and_up.direction, dir_and_up.up)); const float speed = 0.18f; /* TODO: put this in a better place */