Spaces:
Running
Running
Update orbit-camera.js
Browse files- orbit-camera.js +2 -2
orbit-camera.js
CHANGED
|
@@ -77,7 +77,7 @@ OrbitCamera.prototype.update = function (dt) {
|
|
| 77 |
|
| 78 |
var position = new pc.Vec3();
|
| 79 |
position.copy(this._pivotPoint);
|
| 80 |
-
position.
|
| 81 |
|
| 82 |
// 3. If Y would be below minY, clamp pitch upward to keep Y >= minY
|
| 83 |
var minY = this.minY;
|
|
@@ -96,7 +96,7 @@ OrbitCamera.prototype.update = function (dt) {
|
|
| 96 |
quat.setFromEulerAngles(this._pitch, this._yaw, 0);
|
| 97 |
quat.transformVector(pc.Vec3.FORWARD, forward);
|
| 98 |
position.copy(this._pivotPoint);
|
| 99 |
-
position.
|
| 100 |
|
| 101 |
if (position.y < minY) position.y = minY;
|
| 102 |
}
|
|
|
|
| 77 |
|
| 78 |
var position = new pc.Vec3();
|
| 79 |
position.copy(this._pivotPoint);
|
| 80 |
+
position.add(forward.clone().scale(-this._distance)); // <-- Fixed line
|
| 81 |
|
| 82 |
// 3. If Y would be below minY, clamp pitch upward to keep Y >= minY
|
| 83 |
var minY = this.minY;
|
|
|
|
| 96 |
quat.setFromEulerAngles(this._pitch, this._yaw, 0);
|
| 97 |
quat.transformVector(pc.Vec3.FORWARD, forward);
|
| 98 |
position.copy(this._pivotPoint);
|
| 99 |
+
position.add(forward.clone().scale(-this._distance));
|
| 100 |
|
| 101 |
if (position.y < minY) position.y = minY;
|
| 102 |
}
|