feat: Add Simulator component to simulation and enable event logging
This commit is contained in:
parent
22fb00f731
commit
0f716d64a6
|
@ -254,6 +254,71 @@ function processLoadedModel(
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
addEvent(ConveyorEvent);
|
addEvent(ConveyorEvent);
|
||||||
|
} else if (item.modelfileID === "7dc04e36882e4debbc1a8e3d") {
|
||||||
|
// const data = PointsCalculator(
|
||||||
|
// 'Conveyor',
|
||||||
|
// gltf.clone(),
|
||||||
|
// new THREE.Vector3(...model.rotation)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (!data || !data.points) return;
|
||||||
|
|
||||||
|
// const points: ConveyorPointSchema[] = data.points.map((point: THREE.Vector3, index: number) => {
|
||||||
|
// const actionUuid = THREE.MathUtils.generateUUID();
|
||||||
|
// return {
|
||||||
|
// uuid: THREE.MathUtils.generateUUID(),
|
||||||
|
// position: [point.x, point.y, point.z],
|
||||||
|
// rotation: [0, 0, 0],
|
||||||
|
// action: {
|
||||||
|
// actionUuid,
|
||||||
|
// actionName: `Action ${index}`,
|
||||||
|
// actionType: 'default',
|
||||||
|
// material: 'inherit',
|
||||||
|
// delay: 0,
|
||||||
|
// spawnInterval: 5,
|
||||||
|
// spawnCount: 1,
|
||||||
|
// triggers: []
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// });
|
||||||
|
|
||||||
|
// points.forEach((point, index) => {
|
||||||
|
// if (index < points.length - 1) {
|
||||||
|
// const nextPoint = points[index + 1];
|
||||||
|
// point.action.triggers.push({
|
||||||
|
// triggerUuid: THREE.MathUtils.generateUUID(),
|
||||||
|
// triggerName: `Trigger 1`,
|
||||||
|
// triggerType: "onComplete",
|
||||||
|
// delay: 0,
|
||||||
|
// triggeredAsset: {
|
||||||
|
// triggeredModel: {
|
||||||
|
// modelName: item.modelname,
|
||||||
|
// modelUuid: item.modeluuid
|
||||||
|
// },
|
||||||
|
// triggeredPoint: {
|
||||||
|
// pointName: `Point ${index + 1}`,
|
||||||
|
// pointUuid: nextPoint.uuid
|
||||||
|
// },
|
||||||
|
// triggeredAction: {
|
||||||
|
// actionName: nextPoint.action.actionName,
|
||||||
|
// actionUuid: nextPoint.action.actionUuid
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const ConveyorEvent: ConveyorEventSchema = {
|
||||||
|
// modelUuid: item.modeluuid,
|
||||||
|
// modelName: item.modelname,
|
||||||
|
// position: item.position,
|
||||||
|
// rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
||||||
|
// state: "idle",
|
||||||
|
// type: "transfer",
|
||||||
|
// speed: 1,
|
||||||
|
// points
|
||||||
|
// };
|
||||||
|
// addEvent(ConveyorEvent);
|
||||||
} else if (item.modelfileID === "7dc04e36882e4debbc1a8e3d") {
|
} else if (item.modelfileID === "7dc04e36882e4debbc1a8e3d") {
|
||||||
const data = PointsCalculator(
|
const data = PointsCalculator(
|
||||||
'Conveyor',
|
'Conveyor',
|
||||||
|
|
|
@ -8,13 +8,14 @@ import RoboticArm from './roboticArm/roboticArm';
|
||||||
import Materials from './materials/materials';
|
import Materials from './materials/materials';
|
||||||
import Machine from './machine/machine';
|
import Machine from './machine/machine';
|
||||||
import StorageUnit from './storageUnit/storageUnit';
|
import StorageUnit from './storageUnit/storageUnit';
|
||||||
|
import Simulator from './simulator/simulator';
|
||||||
|
|
||||||
function Simulation() {
|
function Simulation() {
|
||||||
const { events } = useEventsStore();
|
const { events } = useEventsStore();
|
||||||
const { products } = useProductStore();
|
const { products } = useProductStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('events: ', events);
|
console.log('events: ', events);
|
||||||
}, [events])
|
}, [events])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -38,6 +39,8 @@ function Simulation() {
|
||||||
|
|
||||||
<StorageUnit />
|
<StorageUnit />
|
||||||
|
|
||||||
|
<Simulator />
|
||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
function Simulator() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Simulator
|
Loading…
Reference in New Issue