diff --git a/app/src/components/layout/scenes/ComparisonScene.tsx b/app/src/components/layout/scenes/ComparisonScene.tsx
index d29b54a..e3c2bab 100644
--- a/app/src/components/layout/scenes/ComparisonScene.tsx
+++ b/app/src/components/layout/scenes/ComparisonScene.tsx
@@ -24,7 +24,6 @@ function ComparisonScene() {
const product = products.find((product) => product.productName === option);
if (product) {
setComparisonProduct(product.productUuid, product.productName);
- setIsPaused(true);
}
};
return (
diff --git a/app/src/components/layout/scenes/MainScene.tsx b/app/src/components/layout/scenes/MainScene.tsx
index 7f398df..a1d0a01 100644
--- a/app/src/components/layout/scenes/MainScene.tsx
+++ b/app/src/components/layout/scenes/MainScene.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useEffect } from "react";
import {
useLoadingProgress,
useRenameModeStore,
@@ -42,7 +42,7 @@ function MainScene() {
const { setMainProduct } = useMainProduct();
const { selectedProductStore } = useProductContext();
const { selectedProduct } = selectedProductStore();
- const { isVersionSaved } = useSaveVersion();
+ const { isVersionSaved, setIsVersionSaved } = useSaveVersion();
const { activeModule } = useModuleStore();
const { selectedUser } = useSelectedUserStore();
const { loadingProgress } = useLoadingProgress();
@@ -52,11 +52,19 @@ function MainScene() {
const { visualizationSocket } = useSocketStore();
const { selectedZone } = useSelectedZoneStore();
const { setFloatingWidget } = useFloatingWidget();
- const { comparisonProduct } = useComparisonProduct();
+ const { clearComparisonProduct } = useComparisonProduct();
const { selectedFloorItem, setSelectedFloorItem } = useSelectedFloorItem();
const { setName } = useAssetsStore();
const { projectId } = useParams()
const { isRenameMode, setIsRenameMode } = useRenameModeStore();
+
+ useEffect(() => {
+ if (activeModule !== 'simulation') {
+ clearComparisonProduct();
+ setIsVersionSaved(false);
+ }
+ }, [activeModule])
+
const handleSelectLayout = (option: string) => {
const product = products.find((product) => product.productName === option);
if (product) {
@@ -99,10 +107,10 @@ function MainScene() {
{activeModule !== "market" && !isPlaying && !isVersionSaved && (
)}
- {(isPlaying || comparisonProduct !== null) &&
+ {(isPlaying) &&
activeModule === "simulation" &&
loadingProgress == 0 && }
- {(isPlaying || comparisonProduct !== null) &&
+ {(isPlaying) &&
activeModule !== "simulation" && }
{isRenameMode && selectedFloorItem?.userData.modelName && }
diff --git a/app/src/components/ui/compareVersion/CompareLayOut.tsx b/app/src/components/ui/compareVersion/CompareLayOut.tsx
index 48bb686..9229dba 100644
--- a/app/src/components/ui/compareVersion/CompareLayOut.tsx
+++ b/app/src/components/ui/compareVersion/CompareLayOut.tsx
@@ -118,7 +118,6 @@ const CompareLayOut = () => {
if (product) {
setComparisonProduct(product.productUuid, product.productName);
setLoadingProgress(1);
- setIsPaused(true);
}
};
diff --git a/app/src/modules/builder/geomentries/walls/hideWalls.ts b/app/src/modules/builder/geomentries/walls/hideWalls.ts
index f8bf52a..02233b0 100644
--- a/app/src/modules/builder/geomentries/walls/hideWalls.ts
+++ b/app/src/modules/builder/geomentries/walls/hideWalls.ts
@@ -1,5 +1,4 @@
import * as THREE from 'three';
-
import * as Types from "../../../../types/world/worldTypes";
function hideWalls(
@@ -7,21 +6,24 @@ function hideWalls(
scene: THREE.Scene,
camera: THREE.Camera
): void {
-
- ////////// Altering the visibility of the Walls when the world direction of the wall is facing the camera //////////
-
- const v = new THREE.Vector3();
- const u = new THREE.Vector3();
+ const wallNormal = new THREE.Vector3();
+ const cameraToWall = new THREE.Vector3();
+ const cameraDirection = new THREE.Vector3();
if (visibility === true) {
for (const children of scene.children) {
if (children.name === "Walls" && children.children[0]?.children.length > 0) {
children.children[0].children.forEach((child: any) => {
if (child.children[0]?.userData.WallType === "RoomWall") {
- child.children[0].getWorldDirection(v);
- camera.getWorldDirection(u);
- if (child.children[0].material) {
- child.children[0].material.visible = (2 * v.dot(u)) >= -0.5;
+ const wallMesh = child.children[0];
+ wallMesh.getWorldDirection(wallNormal);
+ cameraToWall.copy(wallMesh.position).sub(camera.position).normalize();
+ camera.getWorldDirection(cameraDirection);
+ const isFacingCamera = wallNormal.dot(cameraToWall) > 0;
+ const isInFrontOfCamera = cameraDirection.dot(cameraToWall) > -0.3;
+
+ if (wallMesh.material) {
+ wallMesh.material.visible = isFacingCamera && isInFrontOfCamera;
}
}
});
@@ -31,10 +33,8 @@ function hideWalls(
for (const children of scene.children) {
if (children.name === "Walls" && children.children[0]?.children.length > 0) {
children.children[0].children.forEach((child: any) => {
- if (child.children[0]?.userData.WallType === "RoomWall") {
- if (child.children[0].material) {
- child.children[0].material.visible = true;
- }
+ if (child.children[0]?.userData.WallType === "RoomWall" && child.children[0].material) {
+ child.children[0].material.visible = true;
}
});
}
@@ -42,4 +42,4 @@ function hideWalls(
}
}
-export default hideWalls;
+export default hideWalls;
\ No newline at end of file