Merge remote-tracking branch 'origin/main-dev' into main-demo
This commit is contained in:
@@ -51,7 +51,7 @@ export function useRetrieveHandler() {
|
|||||||
isActive: false,
|
isActive: false,
|
||||||
isVisible: false,
|
isVisible: false,
|
||||||
isPaused: false,
|
isPaused: false,
|
||||||
isRendered: false,
|
isRendered: true,
|
||||||
startTime: currentTime,
|
startTime: currentTime,
|
||||||
previous: {
|
previous: {
|
||||||
modelUuid: modelUuid,
|
modelUuid: modelUuid,
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ function OperatorInstance({ human }: { human: HumanStatus }) {
|
|||||||
setHumanState(human.modelUuid, 'running');
|
setHumanState(human.modelUuid, 'running');
|
||||||
setHumanActive(human.modelUuid, true);
|
setHumanActive(human.modelUuid, true);
|
||||||
setCurrentAnimation(human.modelUuid, 'working_standing', true, false, false);
|
setCurrentAnimation(human.modelUuid, 'working_standing', true, false, false);
|
||||||
}, 10)
|
}, 1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function WorkerInstance({ human }: { human: HumanStatus }) {
|
|||||||
const { navMesh } = useNavMesh();
|
const { navMesh } = useNavMesh();
|
||||||
const { isPlaying } = usePlayButtonStore();
|
const { isPlaying } = usePlayButtonStore();
|
||||||
const { scene } = useThree();
|
const { scene } = useThree();
|
||||||
const { assetStore, materialStore, armBotStore, conveyorStore, machineStore, vehicleStore, humanStore, storageUnitStore, productStore } = useSceneContext();
|
const { assetStore, materialStore, armBotStore, conveyorStore, machineStore, vehicleStore, humanStore, storageUnitStore, productStore, humanEventManagerRef } = useSceneContext();
|
||||||
const { removeMaterial, setEndTime, setIsVisible } = materialStore();
|
const { removeMaterial, setEndTime, setIsVisible } = materialStore();
|
||||||
const { getStorageUnitById } = storageUnitStore();
|
const { getStorageUnitById } = storageUnitStore();
|
||||||
const { getArmBotById } = armBotStore();
|
const { getArmBotById } = armBotStore();
|
||||||
@@ -129,23 +129,47 @@ function WorkerInstance({ human }: { human: HumanStatus }) {
|
|||||||
humanStatus(human.modelUuid, 'Started from pickup point, heading to drop point');
|
humanStatus(human.modelUuid, 'Started from pickup point, heading to drop point');
|
||||||
}
|
}
|
||||||
} else if (human.currentMaterials.length > 0 && human.currentLoad > 0 && humanAsset?.animationState?.current !== 'pickup') {
|
} else if (human.currentMaterials.length > 0 && human.currentLoad > 0 && humanAsset?.animationState?.current !== 'pickup') {
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
if (human.currentMaterials[0]?.materialId) {
|
if (human.currentMaterials[0]?.materialId) {
|
||||||
setIsVisible(human.currentMaterials[0]?.materialId, false);
|
setIsVisible(human.currentMaterials[0]?.materialId, false);
|
||||||
}
|
}
|
||||||
humanStatus(human.modelUuid, 'Started to pickup in pickup point');
|
humanStatus(human.modelUuid, 'Started to pickup in pickup point');
|
||||||
setCurrentAnimation(human.modelUuid, 'pickup', true, false, false);
|
setCurrentAnimation(human.modelUuid, 'pickup', true, false, false);
|
||||||
},1)
|
}, 1)
|
||||||
}
|
}
|
||||||
} else if (!human.isActive && human.state === 'idle' && human.currentPhase === 'dropping' && human.currentLoad === 0) {
|
} else if (!human.isActive && human.state === 'idle' && human.currentPhase === 'dropping' && human.currentLoad === 0) {
|
||||||
if (action.pickUpPoint && action.dropPoint) {
|
if (action.pickUpPoint && action.dropPoint) {
|
||||||
const dropToPickup = computePath(action.dropPoint.position || [0, 0, 0], action.pickUpPoint.position || [0, 0, 0]);
|
// const dropToPickup = computePath(action.dropPoint.position || [0, 0, 0], action.pickUpPoint.position || [0, 0, 0]);
|
||||||
setPath(dropToPickup);
|
// setPath(dropToPickup);
|
||||||
setCurrentPhase(human.modelUuid, 'init');
|
// setCurrentPhase(human.modelUuid, 'drop-pickup');
|
||||||
setHumanState(human.modelUuid, 'running');
|
// setHumanState(human.modelUuid, 'running');
|
||||||
setHumanActive(human.modelUuid, true);
|
// setHumanActive(human.modelUuid, true);
|
||||||
setCurrentAnimation(human.modelUuid, 'walking', true, true, true);
|
// setCurrentAnimation(human.modelUuid, 'walking', true, true, true);
|
||||||
humanStatus(human.modelUuid, 'Started from dropping point, heading to pickup point');
|
if (humanEventManagerRef.current) {
|
||||||
|
let state = humanEventManagerRef.current.humanStates.find(h => h.humanId === human.modelUuid);
|
||||||
|
if (state) {
|
||||||
|
const existingAction = state.actionQueue.find(a => a.actionUuid === action.actionUuid);
|
||||||
|
if (existingAction) {
|
||||||
|
const currentCount = existingAction.count ?? 0;
|
||||||
|
if (existingAction.actionType === 'worker') {
|
||||||
|
if (currentCount < existingAction.maxLoadCount) {
|
||||||
|
const dropToPickup = computePath(action.dropPoint.position || [0, 0, 0], action.pickUpPoint.position || [0, 0, 0]);
|
||||||
|
setPath(dropToPickup);
|
||||||
|
setCurrentPhase(human.modelUuid, 'drop-pickup');
|
||||||
|
setHumanState(human.modelUuid, 'running');
|
||||||
|
setHumanActive(human.modelUuid, true);
|
||||||
|
setCurrentAnimation(human.modelUuid, 'walking', true, true, true);
|
||||||
|
} else {
|
||||||
|
setCurrentPhase(human.modelUuid, 'picking');
|
||||||
|
setHumanState(human.modelUuid, 'idle');
|
||||||
|
setHumanActive(human.modelUuid, false);
|
||||||
|
setCurrentAnimation(human.modelUuid, 'idle', true, true, true);
|
||||||
|
humanStatus(human.modelUuid, 'Started from dropping point, heading to pickup point');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -181,7 +181,6 @@ function RoboticArmAnimator({ HandleCallback, restPosition, ikSolver, targetBone
|
|||||||
const nextModel = getEventByModelUuid(selectedProduct.productUuid, currentAction?.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid || '');
|
const nextModel = getEventByModelUuid(selectedProduct.productUuid, currentAction?.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid || '');
|
||||||
const nextPoint = getPointByUuid(selectedProduct.productUuid, currentAction?.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid || '', currentAction?.triggers[0]?.triggeredAsset?.triggeredPoint?.pointUuid || '');
|
const nextPoint = getPointByUuid(selectedProduct.productUuid, currentAction?.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid || '', currentAction?.triggers[0]?.triggeredAsset?.triggeredPoint?.pointUuid || '');
|
||||||
|
|
||||||
console.log('prevModel: ', prevModel);
|
|
||||||
if (prevModel && prevModel.type === 'transfer') {
|
if (prevModel && prevModel.type === 'transfer') {
|
||||||
const material = scene.getObjectByProperty("uuid", currentMaterial);
|
const material = scene.getObjectByProperty("uuid", currentMaterial);
|
||||||
const armbotModel = scene.getObjectByProperty("uuid", armBot.modelUuid);
|
const armbotModel = scene.getObjectByProperty("uuid", armBot.modelUuid);
|
||||||
|
|||||||
Reference in New Issue
Block a user