diff --git a/packages/dev/core/src/Gizmos/positionGizmo.ts b/packages/dev/core/src/Gizmos/positionGizmo.ts index 386ee1cb779..274c422feca 100644 --- a/packages/dev/core/src/Gizmos/positionGizmo.ts +++ b/packages/dev/core/src/Gizmos/positionGizmo.ts @@ -389,6 +389,7 @@ export class PositionGizmo extends Gizmo implements IPositionGizmo { this.onDragStartObservable.clear(); this.onDragObservable.clear(); this.onDragEndObservable.clear(); + super.dispose(); } /** diff --git a/packages/dev/core/src/Gizmos/rotationGizmo.ts b/packages/dev/core/src/Gizmos/rotationGizmo.ts index 34e1b885193..48125d8ea1d 100644 --- a/packages/dev/core/src/Gizmos/rotationGizmo.ts +++ b/packages/dev/core/src/Gizmos/rotationGizmo.ts @@ -391,6 +391,7 @@ export class RotationGizmo extends Gizmo implements IRotationGizmo { this._observables.forEach((obs) => { this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(obs); }); + super.dispose(); } /** diff --git a/packages/dev/core/src/Meshes/abstractMesh.hotSpot.ts b/packages/dev/core/src/Meshes/abstractMesh.hotSpot.ts index f8b38214e03..8bfa3ccc9fc 100644 --- a/packages/dev/core/src/Meshes/abstractMesh.hotSpot.ts +++ b/packages/dev/core/src/Meshes/abstractMesh.hotSpot.ts @@ -121,13 +121,15 @@ export function GetHotSpotToRef(mesh: AbstractMesh, hotSpotQuery: HotSpotQuery, segmentB.subtractInPlace(pointA); segmentA.normalize(); segmentB.normalize(); - Vector3.CrossToRef(segmentB, segmentA, resNormal); + Vector3.CrossToRef(segmentA, segmentB, resNormal); - // flip normal - let invertWinding = mesh.material && mesh.material.sideOrientation === Constants.MATERIAL_CounterClockWiseSideOrientation; - invertWinding ||= mesh.getWorldMatrix().determinant() < 0; - invertWinding ||= mesh.getScene().useRightHandedSystem; - if (invertWinding) { + // flip normal when face culling is changed + const flipNormal = + mesh.material && + mesh.material.sideOrientation === + (mesh.getScene().useRightHandedSystem ? Constants.MATERIAL_ClockWiseSideOrientation : Constants.MATERIAL_CounterClockWiseSideOrientation); + + if (flipNormal) { resNormal.scaleInPlace(-1); }