TiagoCavalcante / r3f-native-orbitcontrols

OrbitControls for React Three Fiber in React Native
MIT License
72 stars 10 forks source link

Can not run in my Ipad #48

Open RyugaRyuzaki opened 1 month ago

RyugaRyuzaki commented 1 month ago

I tried to implement (use expo) here my code:

import * as THREE from "three";
import {StatusBar} from "expo-status-bar";
import {Text, View} from "react-native";
import {Suspense} from "react";
import {Canvas} from "@react-three/fiber/native";
import {useGLTF} from "@react-three/drei/native";
import useControls from "r3f-native-orbitcontrols";
function Model(props: any) {
  const gltf = useGLTF(require("./assets/pmndrs.glb"));
  //@ts-ignore
  return <primitive {...props} object={gltf.scene} />;
}
export default function App() {
  const [OrbitControls, events] = useControls();
  return (
    <View className="relative h-full w-full">
      <Suspense fallback={null}>
        <Canvas className="absolute w-full">
          <OrbitControls enablePan={false} />
          <directionalLight position={[1, 0, 0]} args={["white", 2]} />
          <directionalLight position={[-1, 0, 0]} args={["white", 2]} />
          <directionalLight position={[0, 0, 1]} args={["white", 2]} />
          <directionalLight position={[0, 0, -1]} args={["white", 2]} />
          <directionalLight position={[0, 1, 0]} args={["white", 15]} />
          <directionalLight position={[0, -1, 0]} args={["white", 2]} />
          <mesh>
            <boxGeometry></boxGeometry>
            <meshStandardMaterial color={"orange"}></meshStandardMaterial>
          </mesh>
        </Canvas>
      </Suspense>
    </View>
  );
}

However when i open my ipad, can not rotate or pan in touch. Any idea for this? Many thank