Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed camera tilt up vector
  • Loading branch information
Forchapeatl authored Apr 5, 2025
commit 0dd073bde36230e4f48144d48b215cb8d6d11236
15 changes: 12 additions & 3 deletions src/webgl/p5.Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -1618,16 +1618,25 @@
rotatedCenter[1] += this.eyeY;
rotatedCenter[2] += this.eyeZ;

// Rotate the up vector to keep the correct camera orientation
/* eslint-disable max-len */
let up = new p5.Vector(

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation > Pan() with positive parameter sets correct matrix w/o changing eyeXYZ or upXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.pan src/webgl/p5.Camera.js:1786:10 ❯ test/unit/webgl/p5.Camera.js:93:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation > Pan() with negative parameter sets correct matrix w/o changing eyeXYZ or upXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.pan src/webgl/p5.Camera.js:1786:10 ❯ test/unit/webgl/p5.Camera.js:117:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation > Pan(0) sets correct matrix w/o changing eyeXYZ or upXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.pan src/webgl/p5.Camera.js:1786:10 ❯ test/unit/webgl/p5.Camera.js:138:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation > Tilt() with positive parameter sets correct Matrix w/o changing eyeXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.tilt src/webgl/p5.Camera.js:1851:10 ❯ test/unit/webgl/p5.Camera.js:162:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation > Tilt() with negative parameter sets correct matrix w/o changing eyeXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.tilt src/webgl/p5.Camera.js:1851:10 ❯ test/unit/webgl/p5.Camera.js:182:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation > Tilt(0) sets correct matrix w/o changing eyeXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.tilt src/webgl/p5.Camera.js:1851:10 ❯ test/unit/webgl/p5.Camera.js:200:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation with angleMode(DEGREES) > Pan() with positive parameter sets correct matrix w/o changing eyeXYZ or upXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.pan src/webgl/p5.Camera.js:1786:10 ❯ test/unit/webgl/p5.Camera.js:313:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > Rotation with angleMode(DEGREES) > Tilt() with positive parameter sets correct Matrix w/o changing eyeXYZ

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.tilt src/webgl/p5.Camera.js:1851:10 ❯ test/unit/webgl/p5.Camera.js:336:13

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > slerp() > Behavior of slerp() for camera moved by pan()

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.pan src/webgl/p5.Camera.js:1786:10 ❯ test/unit/webgl/p5.Camera.js:868:12

Check failure on line 1623 in src/webgl/p5.Camera.js

View workflow job for this annotation

GitHub Actions / test

test/unit/webgl/p5.Camera.js > p5.Camera > slerp() > Behavior of slerp() for camera moved by tilt()

ReferenceError: p5 is not defined ❯ Camera._rotateView src/webgl/p5.Camera.js:1623:14 ❯ Camera.tilt src/webgl/p5.Camera.js:1851:10 ❯ test/unit/webgl/p5.Camera.js:890:12
this.upX * rotation.mat4[0] + this.upY * rotation.mat4[4] + this.upZ * rotation.mat4[8],
this.upX * rotation.mat4[1] + this.upY * rotation.mat4[5] + this.upZ * rotation.mat4[9],
this.upX * rotation.mat4[2] + this.upY * rotation.mat4[6] + this.upZ * rotation.mat4[10]
);
/* eslint-enable max-len */
up.normalize()
this.camera(
this.eyeX,
this.eyeY,
this.eyeZ,
rotatedCenter[0],
rotatedCenter[1],
rotatedCenter[2],
this.upX,
this.upY,
this.upZ
up.x,
up.y,
up.z
);
}

Expand Down