diff --git a/app/src/modules/simulation/human/instances/instance/humanInstance.tsx b/app/src/modules/simulation/human/instances/instance/humanInstance.tsx index 7d75aa7..214c1e6 100644 --- a/app/src/modules/simulation/human/instances/instance/humanInstance.tsx +++ b/app/src/modules/simulation/human/instances/instance/humanInstance.tsx @@ -25,7 +25,7 @@ function HumanInstance({ human }: { human: HumanStatus }) { const { getActionByUuid, getEventByModelUuid, getTriggerByUuid } = productStore(); const { selectedProductStore } = useProductContext(); const { selectedProduct } = selectedProductStore(); - const { setHumanActive, setHumanState, setHumanPicking, clearCurrentMaterials, setHumanLoad, decrementHumanLoad, removeLastMaterial, getLastMaterial, incrementIdleTime, incrementActiveTime, resetTime } = humanStore(); + const { setHumanActive, setHumanState, setHumanPicking, clearCurrentMaterials, setHumanLoad, decrementHumanLoad, removeLastMaterial, incrementIdleTime, incrementActiveTime, resetTime } = humanStore(); const [currentPhase, setCurrentPhase] = useState('init'); const [path, setPath] = useState<[number, number, number][]>([]); @@ -34,7 +34,6 @@ function HumanInstance({ human }: { human: HumanStatus }) { const activeTimeRef = useRef(0); const isPausedRef = useRef(false); const isSpeedRef = useRef(0); - let startTime: number; const { speed } = useAnimationPlaySpeed(); const { isPaused } = usePauseButtonStore(); const previousTimeRef = useRef(null); @@ -83,7 +82,6 @@ function HumanInstance({ human }: { human: HumanStatus }) { setHumanLoad(human.modelUuid, 0); resetAnimation(human.modelUuid); setPath([]); - startTime = 0; isPausedRef.current = false; pauseTimeRef.current = 0; resetTime(human.modelUuid) @@ -167,8 +165,7 @@ function HumanInstance({ human }: { human: HumanStatus }) { } } - } - else { + } else { reset() } // eslint-disable-next-line react-hooks/exhaustive-deps @@ -247,7 +244,6 @@ function HumanInstance({ human }: { human: HumanStatus }) { }; }, [human, isPlaying]); - function startUnloadingProcess() { const humanAsset = getAssetById(human.modelUuid); if (humanAsset?.animationState?.current === 'drop' && humanAsset?.animationState?.isCompleted) { @@ -284,12 +280,10 @@ function HumanInstance({ human }: { human: HumanStatus }) { } } else { const droppedMaterial = human.currentLoad; - startTime = performance.now(); handleMaterialDropByDefault(droppedMaterial); } } else { const droppedMaterial = human.currentLoad; - startTime = performance.now(); handleMaterialDropByDefault(droppedMaterial); } } else { diff --git a/app/src/store/builder/useAssetStore.ts b/app/src/store/builder/useAssetStore.ts index ca97bf0..2223d0a 100644 --- a/app/src/store/builder/useAssetStore.ts +++ b/app/src/store/builder/useAssetStore.ts @@ -182,8 +182,10 @@ export const createAssetStore = () => { set((state) => { const asset = state.assets.find(a => a.modelUuid === modelUuid); if (asset?.animationState) { - asset.animationState = { current: '', isPlaying: false, loopAnimation: true, isCompleted: true }; - } + asset.animationState.current = ''; + asset.animationState.isPlaying = true; + asset.animationState.loopAnimation = true; + asset.animationState.isCompleted = true; } }); },