diff --git a/app/src/modules/builder/asset/functions/assetBoundingBox.tsx b/app/src/modules/builder/asset/functions/assetBoundingBox.tsx index da08edf..7736e29 100644 --- a/app/src/modules/builder/asset/functions/assetBoundingBox.tsx +++ b/app/src/modules/builder/asset/functions/assetBoundingBox.tsx @@ -3,8 +3,15 @@ import { useMemo } from "react"; import { Cylinder } from "@react-three/drei"; export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth, }: { name: string; boundingBox: Box3 | null; color: string; lineWidth: number; }) => { - const { edgeCylinders, center, size } = useMemo(() => { - if (!boundingBox) return { edgeCylinders: [], center: new Vector3(), size: new Vector3() }; + const { edgeCylinders, cornerSpheres, center, size } = useMemo(() => { + if (!boundingBox) { + return { + edgeCylinders: [], + cornerSpheres: [], + center: new Vector3(), + size: new Vector3(), + }; + } const min = boundingBox.min; const max = boundingBox.max; @@ -50,7 +57,13 @@ export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth, }: { nam }; }); - return { edgeCylinders, center, size }; + const cornerSpheres = corners.map((corner, i) => ({ + key: `corner-sphere-${i}`, + position: corner.clone(), + radius: radius * 1.5, + })); + + return { edgeCylinders, cornerSpheres, center, size }; }, [boundingBox, lineWidth]); if (!boundingBox) return null; @@ -58,11 +71,18 @@ export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth, }: { nam return ( {edgeCylinders.map(({ key, position, rotation, length, radius }) => ( - + ))} + {cornerSpheres.map(({ key, position, radius }) => ( + + + + + ))} + diff --git a/app/src/modules/builder/asset/models/model/model.tsx b/app/src/modules/builder/asset/models/model/model.tsx index 16f37ee..96076f9 100644 --- a/app/src/modules/builder/asset/models/model/model.tsx +++ b/app/src/modules/builder/asset/models/model/model.tsx @@ -449,7 +449,11 @@ function Model({ asset, isRendered, loader }: { readonly asset: Asset, isRendere ) : ( - + <> + {!isSelected && + + } + )} {isSelected && diff --git a/app/src/modules/simulation/materials/instances/instance/materialInstance.tsx b/app/src/modules/simulation/materials/instances/instance/materialInstance.tsx index 72cd5fe..318759a 100644 --- a/app/src/modules/simulation/materials/instances/instance/materialInstance.tsx +++ b/app/src/modules/simulation/materials/instances/instance/materialInstance.tsx @@ -61,30 +61,12 @@ function MaterialInstance({ material }: { readonly material: MaterialSchema }) { function getCurrentSpeed(productUuid: string, modelUuid: string) { const event = getEventByModelUuid(productUuid, modelUuid) if (event) { - if (event.type === 'transfer') { - return event.speed; - } - - if (event.type === 'vehicle') { - return event.speed; - } - - if (event.type === 'machine') { + if (event.type === 'transfer' || event.type === 'machine' || event.type === 'storageUnit') { return 1; } - - if (event.type === 'roboticArm') { + if (event.type === 'vehicle' || event.type === 'roboticArm' || event.type === 'human') { return event.speed; } - - if (event.type === 'storageUnit') { - return 1; - } - - if (event.type === 'human') { - return event.speed; - } - } else { return 1; } diff --git a/app/src/modules/simulation/materials/instances/materialInstances.tsx b/app/src/modules/simulation/materials/instances/materialInstances.tsx index 88b127f..35bdaef 100644 --- a/app/src/modules/simulation/materials/instances/materialInstances.tsx +++ b/app/src/modules/simulation/materials/instances/materialInstances.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react' +import { useEffect } from 'react' import MaterialInstance from './instance/materialInstance' import { useSceneContext } from '../../../scene/sceneContext'; diff --git a/app/src/modules/simulation/spatialUI/arm/armBotUI.tsx b/app/src/modules/simulation/spatialUI/arm/armBotUI.tsx index 1f4dee8..dfd500a 100644 --- a/app/src/modules/simulation/spatialUI/arm/armBotUI.tsx +++ b/app/src/modules/simulation/spatialUI/arm/armBotUI.tsx @@ -173,13 +173,16 @@ const ArmBotUI = () => { const targetMesh = scene?.getObjectByProperty("uuid", selectedArmBotData?.modelUuid || ''); + const iks = targetMesh?.userData?.iks; + const firstIK = Array.isArray(iks) && iks.length > 0 ? iks[0] : {}; + const { handlePointerDown } = useDraggableGLTF( updatePointToState, { - minDistance: targetMesh?.userData?.iks[0]?.minDistance || 1.2, - maxDistance: targetMesh?.userData?.iks[0]?.maxDistance || 2, - maxheight: targetMesh?.userData?.iks[0]?.maxheight || 0.6, - minheight: targetMesh?.userData?.iks[0]?.minheight || 1.9, + minDistance: firstIK.minDistance ?? 1.2, + maxDistance: firstIK.maxDistance ?? 2, + maxheight: firstIK.maxheight ?? 0.6, + minheight: firstIK.minheight ?? 1.9, } );