如何加载我的3D对象不是来自公共文件夹?

发布于 2025-02-08 08:08:17 字数 775 浏览 3 评论 0原文

我想知道是否有一种方法可以加载我的3D对象(.GLB)将上传到我的AWS服务器,然后我将获得端点。我尝试过,但有一个错误,说“三

 <Suspense fallback={<div  style={{color: 'white' }} className="center">loading</div>}>
      <div style={{height: '100vh' }}>
      <Canvas style={{background: '#000000' }} pixelRatio={[1, 2]} camera={{ position: [-2, 2, 2], fov: 40,}}>
      <directionalLight position={[-5, 10, 5]} intensity={1.5} />
      <ambientLight intensity={0.7} />
        <spotLight intensity={0.5} angle={0.1} penumbra={1} position={[10, 15, 10]} castShadow />
        <Model url="/character.glb" position-y={0.2} scale={[0.5, 0.5, 0.5]} />
        <OrbitControls />
      </Canvas>
      </div>
    </Suspense>

I would like to know if there's a way that I can load my 3d object (.glb) that will be uploaded to my AWS server then I will going to get the endpoint. I tried but there was an error saying "THREE.WebGLRenderer: Context Lost"

The file path of this is the public folder

 <Suspense fallback={<div  style={{color: 'white' }} className="center">loading</div>}>
      <div style={{height: '100vh' }}>
      <Canvas style={{background: '#000000' }} pixelRatio={[1, 2]} camera={{ position: [-2, 2, 2], fov: 40,}}>
      <directionalLight position={[-5, 10, 5]} intensity={1.5} />
      <ambientLight intensity={0.7} />
        <spotLight intensity={0.5} angle={0.1} penumbra={1} position={[10, 15, 10]} castShadow />
        <Model url="/character.glb" position-y={0.2} scale={[0.5, 0.5, 0.5]} />
        <OrbitControls />
      </Canvas>
      </div>
    </Suspense>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文