import HumanInstances from './instances/humanInstances'
import { useEffect, useState } from "react";
import { useSelectedEventSphere } from "../../../store/simulation/useSimulationStore";
import { usePlayButtonStore } from "../../../store/usePlayButtonStore";
import { useSceneContext } from "../../scene/sceneContext";

function Human() {
    const { humanStore } = useSceneContext();
    const { getHumanById } = humanStore();
    const { selectedEventSphere } = useSelectedEventSphere();
    const { isPlaying } = usePlayButtonStore();
    const [isHumanSelected, setIsHumanSelected] = useState(false);

    useEffect(() => {
        if (selectedEventSphere) {
            const selectedVehicle = getHumanById(selectedEventSphere.userData.modelUuid);
            if (selectedVehicle) {
                setIsHumanSelected(true);
            } else {
                setIsHumanSelected(false);
            }
        }
    }, [getHumanById, selectedEventSphere])

    return (
        <>

            <HumanInstances />

        </>
    )
}

export default Human