From 10e7f2f8c4a893fed64d5fdf4e7578c18bae7ea3 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Mon, 28 Jul 2025 12:23:22 +0530 Subject: [PATCH 1/3] Refactor action handling in simulation components for improved clarity and efficiency --- .../mechanics/humanMechanics.tsx | 8 +- .../selection3D/copyPasteControls3D.tsx | 17 ++-- .../selection3D/duplicationControls3D.tsx | 19 +++-- .../selection3D/moveControls3D.tsx | 14 +++- .../selection3D/rotateControls3D.tsx | 10 ++- .../actionHandler/useRetrieveHandler.ts | 61 +++++++++----- .../triggerHandler/useTriggerHandler.ts | 81 ++----------------- 7 files changed, 92 insertions(+), 118 deletions(-) diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx index 6109361..fc73e58 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx @@ -330,15 +330,15 @@ function HumanMechanics() { setSelectedAction(newAction.actionUuid, newAction.actionName); }; - const handleDeleteAction = () => { - if (!selectedPointData || !selectedAction.actionId) return; + const handleDeleteAction = (actionUuid: string) => { + if (!selectedPointData || !actionUuid) return; - const updatedActions = selectedPointData.actions.filter(action => action.actionUuid !== selectedAction.actionId); + const updatedActions = selectedPointData.actions.filter(action => action.actionUuid !== actionUuid); const updatedPoint = { ...selectedPointData, actions: updatedActions }; const event = removeAction( selectedProduct.productUuid, - selectedAction.actionId + actionUuid ); if (event) { diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx index 8fd29e5..24a5f58 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx @@ -137,10 +137,11 @@ const CopyPasteControls3D = ({ if (hit && centerOffset) { pastedObjects.forEach((pastedObject: THREE.Object3D, index: number) => { + const model = scene.getObjectByProperty("uuid", pastedObject.userData.modelUuid); + if (!model) return; const newPos = new THREE.Vector3().addVectors(hit, relativePositions[index]); - setPosition(pastedObject.userData.modelUuid, [newPos.x, 0, newPos.z]); + model.position.set(newPos.x, 0, newPos.z); }); - } }); @@ -204,7 +205,9 @@ const CopyPasteControls3D = ({ if (pastedAsset) { const assetUuid = pastedAsset.userData.modelUuid; const asset = getAssetById(assetUuid); - if (!asset) return; + const model = scene.getObjectByProperty("uuid", pastedAsset.userData.modelUuid); + if (!asset || !model) return; + const position = new THREE.Vector3().copy(model.position); const newFloorItem: Types.FloorItemType = { modelUuid: pastedAsset.userData.modelUuid, @@ -427,7 +430,7 @@ const CopyPasteControls3D = ({ modelUuid: newFloorItem.modelUuid, modelName: newFloorItem.modelName, assetId: newFloorItem.assetId, - position: newFloorItem.position, + position: [position.x, 0, position.z], rotation: { x: pastedAsset.rotation.x, y: pastedAsset.rotation.y, z: pastedAsset.rotation.z }, isLocked: false, isVisible: true, @@ -450,7 +453,7 @@ const CopyPasteControls3D = ({ modelUuid: data.modelUuid, modelName: data.modelName, assetId: data.assetId, - position: data.position, + position: [position.x, 0, position.z], rotation: [data.rotation.x, data.rotation.y, data.rotation.z], isLocked: data.isLocked, isCollidable: false, @@ -466,7 +469,7 @@ const CopyPasteControls3D = ({ modelUuid: newFloorItem.modelUuid, modelName: newFloorItem.modelName, assetId: newFloorItem.assetId, - position: newFloorItem.position, + position: [position.x, 0, position.z], rotation: { x: pastedAsset.rotation.x, y: pastedAsset.rotation.y, z: pastedAsset.rotation.z }, isLocked: false, isVisible: true, @@ -482,7 +485,7 @@ const CopyPasteControls3D = ({ modelUuid: data.modelUuid, modelName: data.modelName, assetId: data.assetId, - position: data.position, + position: [position.x, 0, position.z], rotation: [data.rotation.x, data.rotation.y, data.rotation.z], isLocked: data.isLocked, isCollidable: false, diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx index d32468a..66858a4 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx @@ -29,7 +29,7 @@ const DuplicationControls3D = ({ const { assetStore, eventStore } = useSceneContext(); const { addEvent } = eventStore(); const { projectId } = useParams(); - const { assets, addAsset, setPosition, updateAsset, removeAsset, getAssetById } = assetStore(); + const { assets, addAsset, updateAsset, removeAsset, getAssetById } = assetStore(); const { selectedVersionStore } = useVersionContext(); const { selectedVersion } = selectedVersionStore(); const { userId, organization } = getUserData(); @@ -143,11 +143,14 @@ const DuplicationControls3D = ({ initialPosition, initialPositions[duplicatedObjects[0].userData.modelUuid] ); + const model = scene.getObjectByProperty("uuid", duplicatedObject.userData.modelUuid); const newPosition = new THREE.Vector3().addVectors(adjustedHit, relativeOffset); const positionArray: [number, number, number] = [newPosition.x, newPosition.y, newPosition.z]; - setPosition(duplicatedObject.userData.modelUuid, positionArray); + if (model) { + model.position.set(...positionArray); + } } } }); @@ -205,7 +208,9 @@ const DuplicationControls3D = ({ if (duplicatedAsset) { const assetUuid = duplicatedAsset.userData.modelUuid; const asset = getAssetById(assetUuid); - if (!asset) return; + const model = scene.getObjectByProperty("uuid", duplicatedAsset.userData.modelUuid); + if (!asset || !model) return; + const position = new THREE.Vector3().copy(model.position); const newFloorItem: Types.FloorItemType = { modelUuid: duplicatedAsset.userData.modelUuid, @@ -428,7 +433,7 @@ const DuplicationControls3D = ({ modelUuid: newFloorItem.modelUuid, modelName: newFloorItem.modelName, assetId: newFloorItem.assetId, - position: newFloorItem.position, + position: [position.x, position.y, position.z], rotation: { x: duplicatedAsset.rotation.x, y: duplicatedAsset.rotation.y, z: duplicatedAsset.rotation.z }, isLocked: false, isVisible: true, @@ -451,7 +456,7 @@ const DuplicationControls3D = ({ modelUuid: data.modelUuid, modelName: data.modelName, assetId: data.assetId, - position: data.position, + position: [position.x, position.y, position.z], rotation: [data.rotation.x, data.rotation.y, data.rotation.z], isLocked: data.isLocked, isCollidable: false, @@ -467,7 +472,7 @@ const DuplicationControls3D = ({ modelUuid: newFloorItem.modelUuid, modelName: newFloorItem.modelName, assetId: newFloorItem.assetId, - position: newFloorItem.position, + position: [position.x, position.y, position.z], rotation: { x: duplicatedAsset.rotation.x, y: duplicatedAsset.rotation.y, z: duplicatedAsset.rotation.z }, isLocked: false, isVisible: true, @@ -483,7 +488,7 @@ const DuplicationControls3D = ({ modelUuid: data.modelUuid, modelName: data.modelName, assetId: data.assetId, - position: data.position, + position: [position.x, position.y, position.z], rotation: [data.rotation.x, data.rotation.y, data.rotation.z], isLocked: data.isLocked, isCollidable: false, diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx index 88b8bf6..9ce9b43 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx @@ -38,7 +38,7 @@ function MoveControls3D({ const { userId, organization } = getUserData(); const { projectId } = useParams(); const { assetStore, eventStore, productStore } = useSceneContext(); - const { updateAsset, setPosition, getAssetById } = assetStore(); + const { updateAsset, getAssetById } = assetStore(); const { selectedVersionStore } = useVersionContext(); const { selectedVersion } = selectedVersionStore(); @@ -196,6 +196,7 @@ function MoveControls3D({ raycaster.setFromCamera(pointer, camera); const hit = raycaster.ray.intersectPlane(plane, intersectionPoint); + if (hit) { if (mouseButtonsDown.current.left || mouseButtonsDown.current.right) { if (movedObjects[0]) { @@ -231,11 +232,14 @@ function MoveControls3D({ initialPosition, initialPositions[movedObjects[0].uuid] ); + const model = scene.getObjectByProperty("uuid", movedAsset.userData.modelUuid); const newPosition = new THREE.Vector3().addVectors(baseNewPosition, relativeOffset); const positionArray: [number, number, number] = [newPosition.x, newPosition.y, newPosition.z]; - setPosition(movedAsset.userData.modelUuid, positionArray); + if (model) { + model.position.set(...positionArray); + } } } }); @@ -288,13 +292,15 @@ function MoveControls3D({ if (movedAsset) { const assetUuid = movedAsset.userData.modelUuid; const asset = getAssetById(assetUuid); - if (!asset) return; + const model = scene.getObjectByProperty("uuid", movedAsset.userData.modelUuid); + if (!asset || !model) return; + const position = new THREE.Vector3().copy(model.position); const newFloorItem: Types.FloorItemType = { modelUuid: movedAsset.userData.modelUuid, modelName: movedAsset.userData.modelName, assetId: movedAsset.userData.assetId, - position: asset.position, + position: [position.x, position.y, position.z], rotation: { x: movedAsset.rotation.x, y: movedAsset.rotation.y, z: movedAsset.rotation.z }, isLocked: false, isVisible: true, diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/rotateControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/rotateControls3D.tsx index 83266fd..0ca114d 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/rotateControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/rotateControls3D.tsx @@ -174,12 +174,14 @@ function RotateControls3D({ ); const angleDelta = prevAngle - currentAngle; + const rotationMatrix = new THREE.Matrix4().makeRotationY(angleDelta); + rotatedObjects.forEach((obj: THREE.Object3D) => { if (obj.userData.modelUuid) { - const relativePos = new THREE.Vector3().subVectors(obj.position, center); - relativePos.applyAxisAngle(new THREE.Vector3(0, 1, 0), angleDelta); - obj.position.copy(center).add(relativePos); - obj.rotation.y += angleDelta; + const relativePosition = new THREE.Vector3().subVectors(obj.position, center); + relativePosition.applyMatrix4(rotationMatrix); + obj.position.copy(center).add(relativePosition); + obj.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), angleDelta); } }); diff --git a/app/src/modules/simulation/actions/storageUnit/actionHandler/useRetrieveHandler.ts b/app/src/modules/simulation/actions/storageUnit/actionHandler/useRetrieveHandler.ts index 03c7138..02f33e1 100644 --- a/app/src/modules/simulation/actions/storageUnit/actionHandler/useRetrieveHandler.ts +++ b/app/src/modules/simulation/actions/storageUnit/actionHandler/useRetrieveHandler.ts @@ -3,15 +3,17 @@ import { useFrame } from "@react-three/fiber"; import { usePlayButtonStore, usePauseButtonStore, useResetButtonStore, useAnimationPlaySpeed } from "../../../../../store/usePlayButtonStore"; import { useSceneContext } from "../../../../scene/sceneContext"; import { useProductContext } from "../../../products/productContext"; +import { useHumanEventManager } from "../../../human/eventManager/useHumanEventManager"; export function useRetrieveHandler() { - const { materialStore, armBotStore, vehicleStore, storageUnitStore, productStore, humanStore, assetStore } = useSceneContext(); + const { materialStore, armBotStore, vehicleStore, storageUnitStore, productStore, humanStore, assetStore, humanEventManagerRef } = useSceneContext(); const { selectedProductStore } = useProductContext(); const { addMaterial } = materialStore(); const { getModelUuidByActionUuid, getPointUuidByActionUuid, getEventByModelUuid, getActionByUuid } = productStore(); const { getStorageUnitById, getLastMaterial, updateCurrentLoad, removeLastMaterial } = storageUnitStore(); const { getVehicleById, incrementVehicleLoad, addCurrentMaterial } = vehicleStore(); const { getHumanById, incrementHumanLoad, addCurrentMaterial: addCurrentMaterialToHuman } = humanStore(); + const { addHumanToMonitor } = useHumanEventManager(); const { getAssetById, setCurrentAnimation } = assetStore(); const { selectedProduct } = selectedProductStore(); const { getArmBotById, addCurrentAction } = armBotStore(); @@ -22,6 +24,7 @@ export function useRetrieveHandler() { const [activeRetrievals, setActiveRetrievals] = useState>(new Map()); const retrievalTimeRef = useRef>(new Map()); + const retrievalCountRef = useRef>(new Map()); const [initialDelayComplete, setInitialDelayComplete] = useState(false); const delayTimerRef = useRef(null); @@ -300,27 +303,46 @@ export function useRetrieveHandler() { const humanAsset = getAssetById(triggeredModel.modelUuid); const action = getActionByUuid(selectedProduct.productUuid, human?.currentAction?.actionUuid || ''); - if (human && !human.isScheduled && human.state === 'idle' && human.currentLoad < (action as HumanAction).loadCapacity) { - if (humanAsset && humanAsset.animationState?.current === 'idle') { + if (!action || action.actionType !== 'worker' || !humanEventManagerRef.current) return; + + let state = humanEventManagerRef.current.humanStates.find(h => h.humanId === triggeredModel.modelUuid); + console.log('state: ', state); + console.log('human: ', human); + const currentCount = retrievalCountRef.current.get(actionUuid) ?? 0; + + let conditionMet = false; + if (state) { + console.log('state.actionQueue: ', state.actionQueue); + // state.actionQueue[0].count + } + + if (currentCount >= action.loadCount) { + completedActions.push(actionUuid); + hasChanges = true; + return; + } + + if (human && !human.isScheduled && human.state === 'idle' && human.currentLoad < action.loadCapacity) { + if (humanAsset?.animationState?.current === 'idle') { setCurrentAnimation(human.modelUuid, 'pickup', true, false, false); - } else if (humanAsset && humanAsset.animationState?.current === 'pickup' && humanAsset.animationState.isCompleted) { + } else if (humanAsset?.animationState?.current === 'pickup' && humanAsset.animationState.isCompleted) { const lastMaterial = getLastMaterial(storageUnit.modelUuid); if (lastMaterial) { - if (action && human.currentLoad < (action as HumanAction).loadCapacity) { - const material = createNewMaterial( - lastMaterial.materialId, - lastMaterial.materialType, - storageUnit.point.action - ); - if (material) { - removeLastMaterial(storageUnit.modelUuid); - updateCurrentLoad(storageUnit.modelUuid, -1); - incrementHumanLoad(human.modelUuid, 1); + const material = createNewMaterial( + lastMaterial.materialId, + lastMaterial.materialType, + storageUnit.point.action + ); + if (material) { + removeLastMaterial(storageUnit.modelUuid); + updateCurrentLoad(storageUnit.modelUuid, -1); + incrementHumanLoad(human.modelUuid, 1); + addHumanToMonitor(human.modelUuid, () => { addCurrentMaterialToHuman(human.modelUuid, material.materialType, material.materialId); retrieveLogStatus(material.materialName, `is picked by ${human.modelName}`); - } - if (human.currentLoad + 1 < (action as HumanAction).loadCapacity) { - } + + retrievalCountRef.current.set(actionUuid, currentCount + 1); + }, actionUuid) } } } @@ -352,11 +374,12 @@ export function useRetrieveHandler() { }, []); useEffect(() => { - if (isReset) { + if (isReset || !isPlaying) { setActiveRetrievals(new Map()); + retrievalCountRef.current.clear(); setInitialDelayComplete(false); } - }, [isReset]); + }, [isReset, isPlaying]); return { handleRetrieve, diff --git a/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts b/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts index 15ed931..4dc5ae2 100644 --- a/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts +++ b/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts @@ -714,10 +714,7 @@ export function useTriggerHandler() { setIsVisible(materialId, false); if (action && human) { - - if (human.isActive === false && human.state === 'idle') { - - // Handle current action from arm bot + addHumanToMonitor(human.modelUuid, () => { const model = getEventByModelUuid(selectedProduct.productUuid, action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || ''); if (model?.type === 'transfer') { const conveyor = getConveyorById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || ''); @@ -729,17 +726,14 @@ export function useTriggerHandler() { handleAction(action, materialId) } else { setHumanScheduled(human.modelUuid, true); - addConveyorToMonitor(conveyor.modelUuid, - () => { - handleAction(action, materialId) - } - ) + addConveyorToMonitor(conveyor.modelUuid, () => { + handleAction(action, materialId) + }) } } else { setHumanScheduled(human.modelUuid, true); handleAction(action, materialId) } - // handleAction(action, materialId) } } else if (model?.type === 'vehicle') { const vehicle = getVehicleById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || ''); @@ -751,79 +745,20 @@ export function useTriggerHandler() { handleAction(action, materialId); } else { - // Handle current action using Event Manager setIsPaused(materialId, true); setHumanScheduled(human.modelUuid, true); - addVehicleToMonitor(vehicle.modelUuid, - () => { - handleAction(action, materialId); - } - ) + addVehicleToMonitor(vehicle.modelUuid, () => { + handleAction(action, materialId); + }) } } } else { setHumanScheduled(human.modelUuid, true); handleAction(action, materialId) } - - } else { - - // Handle current action using Event Manager - - addHumanToMonitor(human.modelUuid, () => { - const model = getEventByModelUuid(selectedProduct.productUuid, action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || ''); - if (model?.type === 'transfer') { - const conveyor = getConveyorById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || ''); - if (conveyor) { - const previousModel = getEventByModelUuid(selectedProduct.productUuid, material.previous?.modelUuid || ''); - if (previousModel) { - if (previousModel.type === 'transfer' && previousModel.modelUuid === model.modelUuid) { - - setHumanScheduled(human.modelUuid, true); - handleAction(action, materialId) - } else { - setHumanScheduled(human.modelUuid, true); - addConveyorToMonitor(conveyor.modelUuid, - () => { - handleAction(action, materialId) - } - ) - } - } else { - setHumanScheduled(human.modelUuid, true); - handleAction(action, materialId) - } - } - } else if (model?.type === 'vehicle') { - const vehicle = getVehicleById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || ''); - if (vehicle) { - if (vehicle.isActive === false && vehicle.state === 'idle' && vehicle.isPicking && vehicle.currentLoad < vehicle.point.action.loadCapacity) { - // Handle current action from vehicle - setIsPaused(materialId, true); - setHumanScheduled(human.modelUuid, true); - handleAction(action, materialId); - - } else { - - // Handle current action using Event Manager - setIsPaused(materialId, true); - setHumanScheduled(human.modelUuid, true); - - addVehicleToMonitor(vehicle.modelUuid, - () => { - handleAction(action, materialId); - } - ) - } - } - } else { - setHumanScheduled(human.modelUuid, true); - handleAction(action, materialId) - } - }, action.actionUuid); - } + }, action.actionUuid); } } } From 795c69a3d447552293896eddf506aa4d1a510efd Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Mon, 28 Jul 2025 13:05:32 +0530 Subject: [PATCH 2/3] Enhance shadow handling and visibility settings across components --- .../sidebarRight/properties/GlobalProperties.tsx | 5 +++-- .../modules/builder/asset/models/model/model.tsx | 13 +++++++++++++ .../builder/wall/Instances/instance/wall.tsx | 14 +++++++++----- .../builder/wall/Instances/wallInstances.tsx | 1 + app/src/modules/scene/environment/shadow.tsx | 16 ++++++---------- app/src/types/world/worldConstants.ts | 6 ++++-- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/app/src/components/layout/sidebarRight/properties/GlobalProperties.tsx b/app/src/components/layout/sidebarRight/properties/GlobalProperties.tsx index c075f52..15d32ce 100644 --- a/app/src/components/layout/sidebarRight/properties/GlobalProperties.tsx +++ b/app/src/components/layout/sidebarRight/properties/GlobalProperties.tsx @@ -216,6 +216,7 @@ const GlobalProperties: React.FC = () => { // setRenderDistance(parseInt(e.target.value)); // } // } + return (
@@ -239,12 +240,12 @@ const GlobalProperties: React.FC = () => { label="Wall Visibility" onClick={changeWallVisibility} /> - {/* */} + /> { + if (gltfScene) { + gltfScene.traverse((child: any) => { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + } + }) + } + }, [gltfScene]); + useEffect(() => { setDeletableFloorItem(null); if (selectedFloorItem === null || selectedFloorItem.userData.modelUuid !== asset.modelUuid) { @@ -481,6 +492,8 @@ function Model({ asset }: { readonly asset: Asset }) { rotation={asset.rotation} visible={asset.isVisible} userData={{ ...asset, iks: ikData }} + castShadow + receiveShadow onDoubleClick={(e) => { e.stopPropagation(); if (!toggleView) { diff --git a/app/src/modules/builder/wall/Instances/instance/wall.tsx b/app/src/modules/builder/wall/Instances/instance/wall.tsx index a441ea8..1a73bfe 100644 --- a/app/src/modules/builder/wall/Instances/instance/wall.tsx +++ b/app/src/modules/builder/wall/Instances/instance/wall.tsx @@ -10,7 +10,7 @@ import { useToggleView, useWallVisibility } from '../../../../../store/builder/s import { useBuilderStore } from '../../../../../store/builder/useBuilderStore'; import * as Constants from '../../../../../types/world/worldConstants'; -import DecalInstance from '../../../Decal/decalInstance'; +// import DecalInstance from '../../../Decal/decalInstance'; import defaultMaterial from '../../../../../assets/textures/floor/wall-tex.png'; import material1 from '../../../../../assets/textures/floor/factory wall texture.jpg'; @@ -63,10 +63,10 @@ function Wall({ wall }: { readonly wall: Wall }) { const materials = useMemo(() => { return [ - new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible }), // Left - new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible }), // Right - new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible }), // Top - new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible }), // Bottom + new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible, clipShadows: true }), // Left + new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible, clipShadows: true }), // Right + new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible, clipShadows: true }), // Top + new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, visible: visible, clipShadows: true }), // Bottom new THREE.MeshStandardMaterial({ color: Constants.wallConfig.defaultColor, side: THREE.DoubleSide, @@ -99,11 +99,15 @@ function Wall({ wall }: { readonly wall: Wall }) { return ( (null); const targetRef = useRef(null); const { controls, gl } = useThree(); - const { elevation, setElevation } = useElevation(); - const { azimuth, setAzimuth } = useAzimuth(); + const { elevation } = useElevation(); + const { azimuth } = useAzimuth(); const { planeValue } = useTileDistance(); useEffect(() => { diff --git a/app/src/types/world/worldConstants.ts b/app/src/types/world/worldConstants.ts index 83933b7..0fe8f72 100644 --- a/app/src/types/world/worldConstants.ts +++ b/app/src/types/world/worldConstants.ts @@ -265,8 +265,10 @@ export const planeConfig: PlaneConfig = { export const shadowConfig: ShadowConfig = { shadowOffset: 50, // Offset of the shadow - shadowmapSizewidth: 1024, // Width of the shadow map - shadowmapSizeheight: 1024, // Height of the shadow map + // shadowmapSizewidth: 1024, // Width of the shadow map + // shadowmapSizeheight: 1024, // Height of the shadow map + shadowmapSizewidth: 2048, // Width of the shadow map + shadowmapSizeheight: 2048, // Height of the shadow map // shadowmapSizewidth: 8192, // Width of the shadow map // shadowmapSizeheight: 8192, // Height of the shadow map shadowcamerafar: 70, // Far plane of the shadow camera From f86d36c59f4fc17db47848350d37e8e3b5f68ea9 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Mon, 28 Jul 2025 13:09:08 +0530 Subject: [PATCH 3/3] Fix position format in event update for moved assets --- .../controls/selectionControls/selection3D/moveControls3D.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx index 9ce9b43..bb3a782 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx @@ -312,7 +312,7 @@ function MoveControls3D({ if (eventData) { eventStore.getState().updateEvent(movedAsset.userData.modelUuid, { - position: asset.position, + position: [position.x, position.y, position.z], rotation: [movedAsset.rotation.x, movedAsset.rotation.y, movedAsset.rotation.z], }); } @@ -324,7 +324,7 @@ function MoveControls3D({ selectedProduct.productUuid, movedAsset.userData.modelUuid, { - position: asset.position, + position: [position.x, position.y, position.z], rotation: [movedAsset.rotation.x, movedAsset.rotation.y, movedAsset.rotation.z], } );