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