#
luxiaotao1123
2024-05-11 71f12f94c165bcc6ddf6ebd97c0dc2381c04963a
src/components/camera.jsx
@@ -1,5 +1,5 @@
// 添加场景相机
import { useThree, PerspectiveCameraProps } from '@react-three/fiber';
import React, { useState, useEffect } from 'react';
import { useThree } from '@react-three/fiber';
import {
    PerspectiveCamera,
    CameraControls,
@@ -9,14 +9,23 @@
    FirstPersonControls,
    MapControls,
} from '@react-three/drei';
import React, { useState, useEffect } from 'react';
const Camera = (props) => {
    const threeObj = useThree();
    const camera = threeObj.camera;
    const [choiceCtrls, setChoiceCtrls] = useState(true);
    const mobxStore = useContext(ThreeStoreContext);
    const ctrl = () => {
        return (
            <group>
                {/* 相机控制器 */}
                {/* <PresentationControls /> */}
                <CameraControls />
                {/* <PointerCtrl /> */}
            </group>
        );
    };
    const flyCtrl = () => {
        return (
@@ -33,16 +42,6 @@
        );
    };
    const ctrl = () => {
        return (
            <group>
                {/* 相机控制器 */}
                {/* <PresentationControls /> */}
                <CameraControls />
                {/* <PointerCtrl /> */}
            </group>
        );
    };
    return (
        <>
            {choiceCtrls ? ctrl() : flyCtrl()}