feat: Extend simulation state types to include ArmBot events and update related components
- Updated RotateControls and SelectionControls to handle ArmBot events in simulation states. - Enhanced PathConnector to manage connections involving ArmBot and StaticMachine types. - Added ArmBotMechanics and StaticMachineMechanics components for managing properties of ArmBot and StaticMachine. - Modified types in worldTypes to include rotation for ArmBot and StaticMachine events. - Updated store to accommodate new ArmBot event types in simulation states.
This commit is contained in:
@@ -192,7 +192,7 @@ function processLoadedModel(
|
||||
},
|
||||
]);
|
||||
|
||||
if (item.eventData || item.modelfileID === '67e3db95c2e8f37134526fb2') {
|
||||
if (item.eventData || item.modelfileID === '67e3db5ac2e8f37134526f40' || item.modelfileID === '67eb7904c2e8f37134527eae') {
|
||||
processEventData(item, setSimulationStates);
|
||||
}
|
||||
|
||||
@@ -227,10 +227,10 @@ function processEventData(item: Types.EventData, setSimulationStates: any) {
|
||||
data as Types.VehicleEventsSchema
|
||||
]);
|
||||
|
||||
} else if (item.modelfileID === '67e3db95c2e8f37134526fb2') {
|
||||
} else if (item.modelfileID === '67e3db5ac2e8f37134526f40') {
|
||||
|
||||
const pointUUID = THREE.MathUtils.generateUUID();
|
||||
const pointPosition = new THREE.Vector3(0, 1.75, 0);
|
||||
const pointPosition = new THREE.Vector3(0, 1.5, -0.5);
|
||||
|
||||
const staticMachine: Types.StaticMachineEventsSchema = {
|
||||
modeluuid: item.modeluuid,
|
||||
@@ -243,13 +243,39 @@ function processEventData(item: Types.EventData, setSimulationStates: any) {
|
||||
triggers: { uuid: THREE.MathUtils.generateUUID(), name: 'Trigger 1', type: 'OnComplete' },
|
||||
connections: { source: { modelUUID: item.modeluuid, pointUUID: pointUUID }, targets: [] },
|
||||
},
|
||||
position: item.position
|
||||
position: item.position,
|
||||
rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
||||
};
|
||||
|
||||
|
||||
setSimulationStates((prevEvents: (Types.ConveyorEventsSchema | Types.VehicleEventsSchema | Types.StaticMachineEventsSchema)[]) => [
|
||||
...(prevEvents || []),
|
||||
staticMachine as Types.StaticMachineEventsSchema
|
||||
]);
|
||||
|
||||
} else if (item.modelfileID === '67eb7904c2e8f37134527eae') {
|
||||
const pointUUID = THREE.MathUtils.generateUUID();
|
||||
const pointPosition = new THREE.Vector3(0, 2.75, -0.5);
|
||||
|
||||
const armBot: Types.ArmBotEventsSchema = {
|
||||
modeluuid: item.modeluuid,
|
||||
modelName: item.modelname,
|
||||
type: "ArmBot",
|
||||
points: {
|
||||
uuid: pointUUID,
|
||||
position: [pointPosition.x, pointPosition.y, pointPosition.z],
|
||||
actions: { uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', speed: 1, processes: [] },
|
||||
triggers: { uuid: THREE.MathUtils.generateUUID(), name: 'Trigger 1', type: 'OnComplete' },
|
||||
connections: { source: { modelUUID: item.modeluuid, pointUUID: pointUUID }, targets: [] },
|
||||
},
|
||||
position: item.position,
|
||||
rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
|
||||
}
|
||||
|
||||
setSimulationStates((prevEvents: (Types.ConveyorEventsSchema | Types.VehicleEventsSchema | Types.StaticMachineEventsSchema)[]) => [
|
||||
...(prevEvents || []),
|
||||
armBot as Types.ArmBotEventsSchema
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user