feat: Add animator components for manufacturer, operator, and worker human instances.
This commit is contained in:
@@ -15,7 +15,7 @@ interface ManufacturerAnimatorProps {
|
|||||||
function ManufacturerAnimator({ path, handleCallBack, human, reset }: Readonly<ManufacturerAnimatorProps>) {
|
function ManufacturerAnimator({ path, handleCallBack, human, reset }: Readonly<ManufacturerAnimatorProps>) {
|
||||||
const { humanStore, assetStore, productStore } = useSceneContext();
|
const { humanStore, assetStore, productStore } = useSceneContext();
|
||||||
const { getActionByUuid, selectedProduct } = productStore();
|
const { getActionByUuid, selectedProduct } = productStore();
|
||||||
const { getHumanById } = humanStore();
|
const { getHumanById, incrementDistanceTraveled } = humanStore();
|
||||||
const { setCurrentAnimation } = assetStore();
|
const { setCurrentAnimation } = assetStore();
|
||||||
const { isPaused } = usePauseButtonStore();
|
const { isPaused } = usePauseButtonStore();
|
||||||
const { isPlaying } = usePlayButtonStore();
|
const { isPlaying } = usePlayButtonStore();
|
||||||
@@ -108,7 +108,15 @@ function ManufacturerAnimator({ path, handleCallBack, human, reset }: Readonly<M
|
|||||||
const isAligned = angle < 0.01;
|
const isAligned = angle < 0.01;
|
||||||
|
|
||||||
if (isAligned) {
|
if (isAligned) {
|
||||||
progressRef.current = Math.min(progressRef.current + delta * (speed * human.speed), totalDistance);
|
const distanceStep = delta * (speed * human.speed);
|
||||||
|
const previousProgress = progressRef.current;
|
||||||
|
progressRef.current = Math.min(progressRef.current + distanceStep, totalDistance);
|
||||||
|
const actualStep = progressRef.current - previousProgress;
|
||||||
|
|
||||||
|
if (actualStep > 0) {
|
||||||
|
incrementDistanceTraveled(human.modelUuid, actualStep);
|
||||||
|
}
|
||||||
|
|
||||||
const t = (progressRef.current - accumulatedDistance) / segmentDistance;
|
const t = (progressRef.current - accumulatedDistance) / segmentDistance;
|
||||||
const position = start.clone().lerp(end, t);
|
const position = start.clone().lerp(end, t);
|
||||||
object.position.copy(position);
|
object.position.copy(position);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface WorkerAnimatorProps {
|
|||||||
function OperatorAnimator({ path, handleCallBack, human, reset }: Readonly<WorkerAnimatorProps>) {
|
function OperatorAnimator({ path, handleCallBack, human, reset }: Readonly<WorkerAnimatorProps>) {
|
||||||
const { humanStore, assetStore, productStore } = useSceneContext();
|
const { humanStore, assetStore, productStore } = useSceneContext();
|
||||||
const { getActionByUuid, selectedProduct } = productStore();
|
const { getActionByUuid, selectedProduct } = productStore();
|
||||||
const { getHumanById } = humanStore();
|
const { getHumanById, incrementDistanceTraveled } = humanStore();
|
||||||
const { setCurrentAnimation } = assetStore();
|
const { setCurrentAnimation } = assetStore();
|
||||||
const { isPaused } = usePauseButtonStore();
|
const { isPaused } = usePauseButtonStore();
|
||||||
const { isPlaying } = usePlayButtonStore();
|
const { isPlaying } = usePlayButtonStore();
|
||||||
@@ -116,7 +116,15 @@ function OperatorAnimator({ path, handleCallBack, human, reset }: Readonly<Worke
|
|||||||
const isAligned = angle < 0.01;
|
const isAligned = angle < 0.01;
|
||||||
|
|
||||||
if (isAligned) {
|
if (isAligned) {
|
||||||
progressRef.current = Math.min(progressRef.current + delta * (speed * human.speed), totalDistance);
|
const distanceStep = delta * (speed * human.speed);
|
||||||
|
const previousProgress = progressRef.current;
|
||||||
|
progressRef.current = Math.min(progressRef.current + distanceStep, totalDistance);
|
||||||
|
const actualStep = progressRef.current - previousProgress;
|
||||||
|
|
||||||
|
if (actualStep > 0) {
|
||||||
|
incrementDistanceTraveled(human.modelUuid, actualStep);
|
||||||
|
}
|
||||||
|
|
||||||
const t = (progressRef.current - accumulatedDistance) / segmentDistance;
|
const t = (progressRef.current - accumulatedDistance) / segmentDistance;
|
||||||
const position = start.clone().lerp(end, t);
|
const position = start.clone().lerp(end, t);
|
||||||
object.position.copy(position);
|
object.position.copy(position);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ interface WorkerAnimatorProps {
|
|||||||
function WorkerAnimator({ path, handleCallBack, human, reset, startUnloadingProcess }: Readonly<WorkerAnimatorProps>) {
|
function WorkerAnimator({ path, handleCallBack, human, reset, startUnloadingProcess }: Readonly<WorkerAnimatorProps>) {
|
||||||
const { humanStore, assetStore, productStore } = useSceneContext();
|
const { humanStore, assetStore, productStore } = useSceneContext();
|
||||||
const { getActionByUuid, selectedProduct } = productStore();
|
const { getActionByUuid, selectedProduct } = productStore();
|
||||||
const { getHumanById } = humanStore();
|
const { getHumanById, incrementDistanceTraveled } = humanStore();
|
||||||
const { setCurrentAnimation } = assetStore();
|
const { setCurrentAnimation } = assetStore();
|
||||||
const { isPaused } = usePauseButtonStore();
|
const { isPaused } = usePauseButtonStore();
|
||||||
const { isPlaying } = usePlayButtonStore();
|
const { isPlaying } = usePlayButtonStore();
|
||||||
@@ -118,7 +118,15 @@ function WorkerAnimator({ path, handleCallBack, human, reset, startUnloadingProc
|
|||||||
const isAligned = angle < 0.01;
|
const isAligned = angle < 0.01;
|
||||||
|
|
||||||
if (isAligned) {
|
if (isAligned) {
|
||||||
progressRef.current = Math.min(progressRef.current + delta * (speed * human.speed), totalDistance);
|
const distanceStep = delta * (speed * human.speed);
|
||||||
|
const previousProgress = progressRef.current;
|
||||||
|
progressRef.current = Math.min(progressRef.current + distanceStep, totalDistance);
|
||||||
|
const actualStep = progressRef.current - previousProgress;
|
||||||
|
|
||||||
|
if (actualStep > 0) {
|
||||||
|
incrementDistanceTraveled(human.modelUuid, actualStep);
|
||||||
|
}
|
||||||
|
|
||||||
const t = (progressRef.current - accumulatedDistance) / segmentDistance;
|
const t = (progressRef.current - accumulatedDistance) / segmentDistance;
|
||||||
const position = start.clone().lerp(end, t);
|
const position = start.clone().lerp(end, t);
|
||||||
object.position.copy(position);
|
object.position.copy(position);
|
||||||
|
|||||||
Reference in New Issue
Block a user