Skip to content

Commit

Permalink
fix wrong initilization direction
Browse files Browse the repository at this point in the history
recalculateAngles has to be called with the back direction, but was falsely called with the forward direction in the constructor
  • Loading branch information
LPEdwin authored May 20, 2024
1 parent c653759 commit 1e941f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sample/cameras/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 1e941f2

Please sign in to comment.