Add distance-based scaling to ResizeGizmo handles

- Implement camera distance-based scaling so handles appear consistent visual size
- Add updateHandleScaling() method called every frame
- Use 0.2 multiplier for scale factor (adjustable)
- Handles maintain mesh rotation alignment (not billboarded)
- Keeps existing utility layer configuration for compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Michael Mainguy 2025-11-17 20:10:14 -06:00
parent 1ab3deae92
commit 6643379133

View File

@ -184,6 +184,9 @@ export class ResizeGizmo {
// Check for handle picking with XR controllers
this.checkXRControllerPicking();
// Update handle scaling based on camera distance
this.updateHandleScaling();
// Update scaling if active
if (this._isScaling) {
this.updateScaling();
@ -194,6 +197,20 @@ export class ResizeGizmo {
});
}
/**
* Update handle scaling based on camera distance for consistent visual size
*/
private updateHandleScaling(): void {
const camera = this._scene.activeCamera;
if (!camera) return;
for (const handle of this._handles) {
const distance = Vector3.Distance(camera.globalPosition, handle.position);
const scaleFactor = distance * 0.2; // Adjust multiplier to control visual size
handle.scaling = new Vector3(scaleFactor, scaleFactor, scaleFactor);
}
}
/**
* Check if XR controllers are pointing at any handles
*/