pan method
dynamic
pan(
- dynamic p0,
- dynamic p1, [
- dynamic adjust = false
Perform pan operation moving camera between two points @param {Vector3} p0 Initial point @param {Vector3} p1 Ending point @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)
Implementation
pan(p0, p1, [adjust = false]) {
var movement = p0.clone().sub(p1);
if (camera is OrthographicCamera) {
//adjust movement amount
movement.multiplyScalar(1 / camera.zoom);
} else if (camera is PerspectiveCamera && adjust) {
//adjust movement amount
_v3_1.setFromMatrixPosition(_cameraMatrixState0); //camera's initial position
_v3_2.setFromMatrixPosition(_gizmoMatrixState0); //gizmo's initial position
var distanceFactor = _v3_1.distanceTo(_v3_2) / camera.position.distanceTo(_gizmos.position);
movement.multiplyScalar(1 / distanceFactor);
}
_v3_1.set(movement.x, movement.y, 0).applyQuaternion(camera.quaternion);
_m4_1.makeTranslation(_v3_1.x, _v3_1.y, _v3_1.z);
setTransformationMatrices(_m4_1, _m4_1);
return _transformation;
}