Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/preview release/what's new.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- Force compute world matrix of the newly-attached mesh of a ray helper ([RaananW](https://github.com/RaananW))
- Allow 180 monoscopic videos on top of the video dome ([#8575](https://github.com/BabylonJS/Babylon.js/issues/8575)) ([RaananW](https://github.com/RaananW))
- Added `AssetContainerTask` support to `AssetsManager` class ([MackeyK24](https://github.com/MackeyK24))
- Added `fixedDragMeshBoundsSize` for boundingbox gizmo to size anchors from bounds size ([cedricguillemet](https://github.com/cedricguillemet))
- Changed DeviceSourceManager getInput contract to no longer return nullable values ([Drigax](https://github.com/drigax))
- Photo Dome and Video Dome now use the same abstract class and support the same parameters ([#8771](https://github.com/BabylonJS/Babylon.js/issues/8771)) ([RaananW](https://github.com/RaananW))
- Added `getTransformNodesByTags` support to `Scene` class ([MackeyK24](https://github.com/MackeyK24))
Expand Down
13 changes: 11 additions & 2 deletions src/Gizmos/boundingBoxGizmo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ export class BoundingBoxGizmo extends Gizmo {
public scaleBoxSize = 0.1;
/**
* If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)
* Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true
*/
public fixedDragMeshScreenSize = false;

/**
* If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box
* Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true
*/
public fixedDragMeshBoundsSize = false;
/**
* The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)
*/
Expand Down Expand Up @@ -353,7 +358,7 @@ export class BoundingBoxGizmo extends Gizmo {
// Only update the bouding box if scaling has changed
if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {
this.updateBoundingBox();
} else if (this.fixedDragMeshScreenSize) {
} else if (this.fixedDragMeshScreenSize || this.fixedDragMeshBoundsSize) {
this._updateRotationSpheres();
this._updateScaleBoxes();
}
Expand Down Expand Up @@ -491,6 +496,8 @@ export class BoundingBoxGizmo extends Gizmo {
rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
var distanceFromCamera = this.rotationSphereSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
} else if (this.fixedDragMeshBoundsSize) {
rotateSpheres[index].scaling.set(this.rotationSphereSize * this._boundingDimensions.x, this.rotationSphereSize * this._boundingDimensions.y, this.rotationSphereSize * this._boundingDimensions.z);
} else {
rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);
}
Expand All @@ -516,6 +523,8 @@ export class BoundingBoxGizmo extends Gizmo {
scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);
var distanceFromCamera = this.scaleBoxSize * this._tmpVector.length() / this.fixedDragMeshScreenSizeDistanceFactor;
scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);
} else if (this.fixedDragMeshBoundsSize) {
scaleBoxes[index].scaling.set(this.scaleBoxSize * this._boundingDimensions.x, this.scaleBoxSize * this._boundingDimensions.y, this.scaleBoxSize * this._boundingDimensions.z);
} else {
scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);
}
Expand Down