Skip to content

Commit

Permalink
added the code from dave's example for keeping the camera z constant
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomGamingDev committed Oct 25, 2023
1 parent 6512043 commit 58b3862
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/webgl/p5.Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -1948,12 +1948,12 @@ p5.Camera = class Camera {
// @TODO: combine this function with _setDefaultCamera to compute these values
// as-needed
_computeCameraDefaultSettings() {
this.defaultCameraFOV = 60 / 180 * Math.PI;
this.defaultCameraFOV =
2 * Math.atan(this._renderer.height / 2 / this.defaultEyeZ);
this.defaultAspectRatio = this._renderer.width / this._renderer.height;
this.defaultEyeX = 0;
this.defaultEyeY = 0;
this.defaultEyeZ =
this._renderer.height / 2.0 / Math.tan(this.defaultCameraFOV / 2.0);
this.defaultEyeZ = 800;
this.defaultCenterX = 0;
this.defaultCenterY = 0;
this.defaultCenterZ = 0;
Expand Down

0 comments on commit 58b3862

Please sign in to comment.