* 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)
| 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. |
no test coverage detected