所以我探索了多种关于在我的网络应用程序中渲染我的搅拌机模型的选项,现在我正在将我的模型导出为一种.gltf
格式,这是我的代码
应用程序.js
import React, { Suspense } from 'react';
import './App.css';
import Model from './Model'
function App() {
return (
<div className="App">
<Suspense fallback={null}>
<Model />
</Suspense>
</div>
);
}
export default App;
模型.js
import React from 'react'
import { useLoader } from 'react-three-fiber'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
import Scene from './scene.gltf'
function Model(props) {
const { nodes, materials } = useLoader(GLTFLoader, Scene)
return (
<div>
</div>
)
}
export default Model
问题
GLTF 加载程序抛出错误
我想要的是
- 我想尽可能简单地渲染我的模型,因为它在反应应用程序的搅拌器中显示
- 旋转控制会很棒..
抛出错误
RangeError: Invalid typed array length: 1299
at new Float32Array (<anonymous>)
at GLTFLoader.js:1965
at async Promise.all (:3000/index 0)
at async Promise.all (:3000/index 0)
at async Promise.all (:3000/index 4)
at async Promise.all (:3000/index 0)
at async Promise.all (:3000/index 2)
at async Promise.all (:3000/index 0)
at async Promise.all