feat: Implement ArmBot simulation with IK animation and event handling

- Added ArmBot component to manage ArmBot instances in the simulation.
- Created ArmBotInstances component to render individual ArmBot models.
- Developed IKAnimationController for handling inverse kinematics during animations.
- Introduced IkInstances component to load and manage IK-enabled arm models.
- Defined simulation types for ArmBot events and connections in TypeScript.
- Enhanced type definitions for better clarity and maintainability.
This commit is contained in:
2025-04-14 18:16:53 +05:30
parent ba215dd0d3
commit 37df5e8801
32 changed files with 923 additions and 949 deletions

View File

@@ -2,7 +2,7 @@ import React, { useRef, useMemo, useCallback } from "react";
import { InfoIcon } from "../../../icons/ExportCommonIcons";
import InputWithDropDown from "../../../ui/inputs/InputWithDropDown";
import { useSelectedActionSphere, useSimulationStates, useSocketStore } from "../../../../store/store";
import * as Types from '../../../../types/world/worldTypes';
import * as SimulationTypes from '../../../../types/simulation';
import LabledDropdown from "../../../ui/inputs/LabledDropdown";
import { setEventApi } from "../../../../services/factoryBuilder/assest/floorAsset/setEventsApt";
@@ -17,7 +17,7 @@ const StaticMachineMechanics: React.FC = () => {
if (!selectedActionSphere?.points?.uuid) return { selectedPoint: null, connectedPointUuids: [] };
const staticMachinePaths = simulationStates.filter(
(path): path is Types.StaticMachineEventsSchema => path.type === "StaticMachine"
(path): path is SimulationTypes.StaticMachineEventsSchema => path.type === "StaticMachine"
);
const points = staticMachinePaths.find(
@@ -39,7 +39,7 @@ const StaticMachineMechanics: React.FC = () => {
};
}, [selectedActionSphere, simulationStates]);
const updateBackend = async (updatedPath: Types.StaticMachineEventsSchema | undefined) => {
const updateBackend = async (updatedPath: SimulationTypes.StaticMachineEventsSchema | undefined) => {
if (!updatedPath) return;
const email = localStorage.getItem("email");
const organization = email ? email.split("@")[1].split(".")[0] : "";
@@ -59,7 +59,7 @@ const StaticMachineMechanics: React.FC = () => {
socket.emit('v2:model-asset:updateEventData', data);
}
const handleActionUpdate = useCallback((updatedAction: Partial<Types.StaticMachineEventsSchema['points']['actions']>) => {
const handleActionUpdate = useCallback((updatedAction: Partial<SimulationTypes.StaticMachineEventsSchema['points']['actions']>) => {
if (!selectedActionSphere?.points?.uuid) return;
const updatedPaths = simulationStates.map((path) => {
@@ -79,7 +79,7 @@ const StaticMachineMechanics: React.FC = () => {
});
const updatedPath = updatedPaths.find(
(path): path is Types.StaticMachineEventsSchema =>
(path): path is SimulationTypes.StaticMachineEventsSchema =>
path.type === "StaticMachine" &&
path.points.uuid === selectedActionSphere.points.uuid
);
@@ -96,7 +96,7 @@ const StaticMachineMechanics: React.FC = () => {
handleActionUpdate({ material });
}, [handleActionUpdate]);
const handleTriggerChange = useCallback((updatedTrigger: Partial<Types.StaticMachineEventsSchema['points']['triggers']>) => {
const handleTriggerChange = useCallback((updatedTrigger: Partial<SimulationTypes.StaticMachineEventsSchema['points']['triggers']>) => {
if (!selectedActionSphere?.points?.uuid) return;
const updatedPaths = simulationStates.map((path) => {
@@ -116,7 +116,7 @@ const StaticMachineMechanics: React.FC = () => {
});
const updatedPath = updatedPaths.find(
(path): path is Types.StaticMachineEventsSchema =>
(path): path is SimulationTypes.StaticMachineEventsSchema =>
path.type === "StaticMachine" &&
path.points.uuid === selectedActionSphere.points.uuid
);