MCPcopy Index your code
hub / github.com/processing/p5.js / roll

Method roll

src/webgl/p5.Camera.js:672–691  ·  view source on GitHub ↗

* Rotates the camera in a clockwise/counter-clockwise direction. * * Rolling rotates the camera without changing its orientation. The rotation * happens in the camera’s "local" space. * * The parameter, `angle`, is the angle the camera should rotate. Passing a * positive angle, as

(amount)

Source from the content-addressed store, hash-verified

670 * camera view rotates in counter clockwise direction with vertically stacked boxes in front of it.
671 */
672 roll(amount) {
673 const local = this._getLocalAxes();
674 const axisQuaternion = Quat.fromAxisAngle(
675 this._renderer._pInst._toRadians(amount),
676 local.z[0], local.z[1], local.z[2]);
677 // const upQuat = new p5.Quat(0, this.upX, this.upY, this.upZ);
678 const newUpVector = axisQuaternion.rotateVector(
679 new Vector(this.upX, this.upY, this.upZ));
680 this.camera(
681 this.eyeX,
682 this.eyeY,
683 this.eyeZ,
684 this.centerX,
685 this.centerY,
686 this.centerZ,
687 newUpVector.x,
688 newUpVector.y,
689 newUpVector.z
690 );
691 }
692
693 /**
694 * Rotates the camera left and right.

Callers 1

p5.Camera.jsFile · 0.80

Calls 4

_getLocalAxesMethod · 0.95
cameraMethod · 0.95
fromAxisAngleMethod · 0.80
rotateVectorMethod · 0.80

Tested by

no test coverage detected