feat: Implement human simulation features

- Added human event handling in the simulation, including the ability to add, update, and remove human instances.
- Introduced a new Human store to manage human states and actions.
- Updated the simulation context to include human management.
- Enhanced the Points and TriggerConnector components to support human interactions.
- Refactored existing components to integrate human-related functionalities.
- Added HumanInstance and HumanInstances components for rendering human entities in the simulation.
- Updated TypeScript definitions to include human-related types and actions.
This commit is contained in:
2025-07-02 15:07:31 +05:30
parent 3f59f5d2dd
commit 7519aa90c6
22 changed files with 706 additions and 144 deletions

View File

@@ -352,6 +352,37 @@ function PointsCreator() {
</mesh>
</group>
);
} else if (usedEvent.type === "human") {
const point = usedEvent.point;
return (
<group
key={`${index}-${usedEvent.modelUuid}`}
position={usedEvent.position}
rotation={usedEvent.rotation}
>
<mesh
name="Event-Sphere"
uuid={point.uuid}
ref={(el) => (sphereRefs.current[point.uuid] = el!)}
onClick={(e) => {
e.stopPropagation();
if (toolMode === 'cursor') {
setSelectedEventSphere(
sphereRefs.current[point.uuid]
);
}
}}
position={new THREE.Vector3(...point.position)}
userData={{
modelUuid: usedEvent.modelUuid,
pointUuid: point.uuid,
}}
>
<sphereGeometry args={[0.1, 16, 16]} />
<meshStandardMaterial color="white" />
</mesh>
</group>
);
} else {
return null;
}

View File

@@ -1,4 +1,3 @@
import React from 'react'
import PointsCreator from './creator/pointsCreator'
function Points() {

View File

@@ -152,6 +152,22 @@ function TriggerConnector() {
});
}
}
// Handle Human point
else if (event.type === "human" && 'point' in event) {
const point = event.point;
point.actions?.forEach(action => {
action.triggers?.forEach(trigger => {
if (trigger.triggeredAsset && trigger.triggeredAsset.triggeredPoint) {
newConnections.push({
id: `${point.uuid}-${trigger.triggeredAsset.triggeredPoint.pointUuid}-${trigger.triggerUuid}`,
startPointUuid: point.uuid,
endPointUuid: trigger.triggeredAsset.triggeredPoint.pointUuid,
trigger
});
}
});
});
}
});
setConnections(newConnections);