Skip to content

Commit

Permalink
Merge pull request #5454 from TrevorDev/boundingBoxRotateThroughBox
Browse files Browse the repository at this point in the history
Bounding box rotate through box
  • Loading branch information
deltakosh committed Nov 1, 2018
2 parents 3a8c502 + ad1e128 commit c493e09
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/preview release/what's new.md
Expand Up @@ -79,7 +79,7 @@
- CreateScreenshotUsingRenderTarget stretches mirror textures when setting both width and height ([TrevorDev](https://github.com/TrevorDev))
- VR helper only updating vr cameras position when entering vr, rotation was missing ([TrevorDev](https://github.com/TrevorDev))
- Fix VR controllers after gltfLoader transformNode change ([TrevorDev](https://github.com/TrevorDev))
- Bounding Box fixedDragMeshScreenSize stopped working ([TrevorDev](https://github.com/TrevorDev))
- Bounding Box fixedDragMeshScreenSize stopped working and allow rotating through bounding box ([TrevorDev](https://github.com/TrevorDev))
- VR helper would rotate non vr camera while in VR ([TrevorDev](https://github.com/TrevorDev))

### Core Engine
Expand Down
2 changes: 1 addition & 1 deletion src/Gizmos/babylon.boundingBoxGizmo.ts
Expand Up @@ -176,7 +176,7 @@ module BABYLON {
var dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();

// project drag delta on to the resulting drag axis and rotate based on that
var projectDist = -Vector3.Dot(dragAxis, event.delta);
var projectDist = Vector3.Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());

// Make rotation relative to size of mesh.
projectDist = (projectDist / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();
Expand Down
7 changes: 6 additions & 1 deletion src/Rendering/babylon.utilityLayerRenderer.ts
Expand Up @@ -7,6 +7,11 @@ module BABYLON {
private _lastPointerEvents: { [pointerId: number]: boolean } = {};
private static _DefaultUtilityLayer: Nullable<UtilityLayerRenderer> = null;
private static _DefaultKeepDepthUtilityLayer: Nullable<UtilityLayerRenderer> = null;

/**
* If the picking should be done on the utility layer prior to the actual scene (Default: true)
*/
public pickUtilitySceneFirst = true;
/**
* A shared utility layer that can be used to overlay objects into a scene (Depth map of the previous scene is cleared before drawing on top of it)
*/
Expand Down Expand Up @@ -113,7 +118,7 @@ module BABYLON {
return;
}

if (this.utilityLayerScene.autoClearDepthAndStencil) {
if (this.utilityLayerScene.autoClearDepthAndStencil || this.pickUtilitySceneFirst) {
// If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene
if (utilityScenePick && utilityScenePick.hit) {

Expand Down

0 comments on commit c493e09

Please sign in to comment.