From 1e941f2381ef8cf96feb31b904cdaf8c8b611cfc Mon Sep 17 00:00:00 2001 From: EB Date: Mon, 20 May 2024 20:11:55 +0200 Subject: [PATCH] fix wrong initilization direction recalculateAngles has to be called with the back direction, but was falsely called with the forward direction in the constructor --- sample/cameras/camera.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/cameras/camera.ts b/sample/cameras/camera.ts index ef671479..0f24ea4b 100644 --- a/sample/cameras/camera.ts +++ b/sample/cameras/camera.ts @@ -134,8 +134,8 @@ export class WASDCamera extends CameraBase implements Camera { if (options && (options.position || options.target)) { const position = options.position ?? vec3.create(0, 0, -5); const target = options.target ?? vec3.create(0, 0, 0); - const forward = vec3.normalize(vec3.sub(target, position)); - this.recalculateAngles(forward); + const back = vec3.normalize(vec3.sub(position, target)); + this.recalculateAngles(back); this.position = position; } }