movement bug half fixed
This commit is contained in:
@@ -30,6 +30,8 @@ function ManufacturerAnimator({ path, handleCallBack, human, reset }: Readonly<M
|
||||
|
||||
useEffect(() => {
|
||||
if (!human.currentAction?.actionUuid) return;
|
||||
completedRef.current = true;
|
||||
|
||||
if (human.currentPhase === "init-manufacture" && path.length > 0) {
|
||||
setCurrentPath(path);
|
||||
setObjectRotation((action as HumanAction)?.manufacturePoint?.rotation ?? null);
|
||||
@@ -64,7 +66,7 @@ function ManufacturerAnimator({ path, handleCallBack, human, reset }: Readonly<M
|
||||
lastTimeRef.current = now;
|
||||
|
||||
const object = scene.getObjectByProperty("uuid", human.modelUuid);
|
||||
if (!object || currentPath.length < 2) return;
|
||||
if (!object || currentPath.length < 2 || completedRef.current) return;
|
||||
if (isPaused || !isPlaying) return;
|
||||
|
||||
let totalDistance = 0;
|
||||
@@ -131,6 +133,7 @@ function ManufacturerAnimator({ path, handleCallBack, human, reset }: Readonly<M
|
||||
object.quaternion.copy(targetQuaternion);
|
||||
setCurrentAnimation(human.modelUuid, "idle", true, true, true);
|
||||
progressRef.current = 0;
|
||||
completedRef.current = true;
|
||||
setCurrentPath([]);
|
||||
handleCallBack();
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,8 @@ function WorkerAnimator({ path, handleCallBack, human, reset, startUnloadingProc
|
||||
useEffect(() => {
|
||||
if (!human.currentAction?.actionUuid) return;
|
||||
const action = getActionByUuid(selectedProduct.productUuid, human?.currentAction?.actionUuid || "");
|
||||
completedRef.current = true;
|
||||
|
||||
if (human.currentPhase === "init-pickup" && path.length > 0) {
|
||||
setCurrentPath(path);
|
||||
setObjectRotation((action as HumanAction).pickUpPoint?.rotation ?? null);
|
||||
@@ -74,7 +76,7 @@ function WorkerAnimator({ path, handleCallBack, human, reset, startUnloadingProc
|
||||
lastTimeRef.current = now;
|
||||
|
||||
const object = scene.getObjectByProperty("uuid", human.modelUuid);
|
||||
if (!object || currentPath.length < 2) return;
|
||||
if (!object || currentPath.length < 2 || completedRef.current) return;
|
||||
if (isPaused || !isPlaying) return;
|
||||
|
||||
let totalDistance = 0;
|
||||
@@ -150,6 +152,7 @@ function WorkerAnimator({ path, handleCallBack, human, reset, startUnloadingProc
|
||||
setCurrentAnimation(human.modelUuid, human.currentMaterials.length > 0 ? "idle_with_box" : "idle", true, true, true);
|
||||
progressRef.current = 0;
|
||||
movingForward.current = !movingForward.current;
|
||||
completedRef.current = true;
|
||||
setCurrentPath([]);
|
||||
handleCallBack();
|
||||
if (human.currentPhase === "pickup-drop") {
|
||||
|
||||
Reference in New Issue
Block a user