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:
@@ -301,20 +301,21 @@ function Model({ asset }: { readonly asset: Asset }) {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const handlePlay = (clipName: string) => {
|
||||
|
||||
if (asset.animationState && asset.animationState.playing) {
|
||||
if (!mixerRef.current) return;
|
||||
|
||||
Object.values(actions.current).forEach((action) => action.stop());
|
||||
|
||||
const action = actions.current[clipName];
|
||||
const action = actions.current[asset.animationState.current];
|
||||
if (action && asset.animationState?.playing) {
|
||||
action.reset().setLoop(THREE.LoopOnce, 1).play();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
Object.values(actions.current).forEach((action) => action.stop());
|
||||
}
|
||||
|
||||
handlePlay(asset.animationState?.current || '');
|
||||
|
||||
}, [asset])
|
||||
}, [asset.animationState])
|
||||
|
||||
return (
|
||||
<group
|
||||
@@ -362,17 +363,6 @@ function Model({ asset }: { readonly asset: Asset }) {
|
||||
<AssetBoundingBox boundingBox={boundingBox} />
|
||||
)
|
||||
)}
|
||||
{/* <group >
|
||||
<Html>
|
||||
<div style={{ position: 'absolute', }}>
|
||||
{animationNames.map((name) => (
|
||||
<button key={name} onClick={() => handlePlay(name)} style={{ margin: 4 }}>
|
||||
{name}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</Html>
|
||||
</group> */}
|
||||
</group >
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user