Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gizmo fixes #6763

Merged
merged 11 commits into from
Jun 28, 2024
Prev Previous commit
Next Next commit
use distance instead of length for scale
  • Loading branch information
kpal81xd committed Jun 27, 2024
commit 3d4d0cd0f99fc89e2edf81e4655e5c8a6d2be238
2 changes: 1 addition & 1 deletion src/extras/gizmo/gizmo.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class Gizmo extends EventHandler {
if (this._camera.projection === PROJECTION_PERSPECTIVE) {
const gizmoPos = this.root.getPosition();
const cameraPos = this._camera.entity.getPosition();
const dist = gizmoPos.sub(cameraPos).length();
const dist = gizmoPos.distance(cameraPos);
this._scale = Math.tan(0.5 * this._camera.fov * math.DEG_TO_RAD) * dist * PERS_SCALE_RATIO;
} else {
this._scale = this._camera.orthoHeight * ORTHO_SCALE_RATIO;
Expand Down