diff options
| author | 3gg <3gg@shellblade.net> | 2025-10-24 19:17:36 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-10-24 19:17:36 -0700 |
| commit | 02b70c053cc5f896e8a5105245bf8dd174643ae7 (patch) | |
| tree | 9b5397af18905ab428fc2e2714a7a76d6dfb0ea3 /src | |
| parent | 7dc946e85a0fbb7f0afe18ac72402ce0d075ad60 (diff) | |
Normalize camera translation vector
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/viewer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/viewer.c b/src/plugins/viewer.c index bbdd2ae..b05cfe1 100644 --- a/src/plugins/viewer.c +++ b/src/plugins/viewer.c | |||
| @@ -225,8 +225,8 @@ static void update_camera( | |||
| 225 | (R)(command.CameraMoveRight ? 1 : 0); | 225 | (R)(command.CameraMoveRight ? 1 : 0); |
| 226 | const R move_y = (R)(command.CameraMoveForward ? 1 : 0) + | 226 | const R move_y = (R)(command.CameraMoveForward ? 1 : 0) + |
| 227 | (R)(command.CameraMoveBackward ? -1 : 0); | 227 | (R)(command.CameraMoveBackward ? -1 : 0); |
| 228 | const vec2 translation = | 228 | const vec2 translation = vec2_scale( |
| 229 | vec2_scale(vec2_make(move_x, move_y), controller->camera_speed * dt); | 229 | vec2_normalize(vec2_make(move_x, move_y)), controller->camera_speed * dt); |
| 230 | spatial3_move_right(camera, translation.x); | 230 | spatial3_move_right(camera, translation.x); |
| 231 | spatial3_move_forwards(camera, translation.y); | 231 | spatial3_move_forwards(camera, translation.y); |
| 232 | 232 | ||
