Import GLTF with TresJS in Nuxt

36 Views Asked by At

I'm stuggling to import a gltf model with TresJS.

GLTFModel is working fine - useGLTF doesn't find my asset.

I'm totally new to nuxt and TresJS, so any help is appreciated.

I keep getting a "500 - Failed to parse URL from /figur.gltf"

Thanks


<script setup>
  import { OrbitControls, useGLTF, GLTFModel } from '@tresjs/cientos'
  const { scene, nodes, animations, materials } = await useGLTF('/figur.gltf', { draco: true })

<!-- useGLTF not working...  -->

</script>

<template>

  <TresCanvas
    window-size
    clear-color="#444444"
    shadows
    alpha
  >
    <TresPerspectiveCamera :position="[500, 500, 500]" :args="[45, 1, 0.1, 100000]"/>
    <OrbitControls />
    <TresAmbientLight :intensity="2" />
    <TresMesh>
      <TresTorusGeometry :args="[1, 0.5, 16, 32]" />
      <TresMeshBasicMaterial color="orange" />
    </TresMesh>
    <Suspense>
       <primitive :object=" nodes " />
       <!-- <GLTFModel path="/figur.gltf" draco />   Working -->
    </Suspense>
  </TresCanvas>
</template>
0

There are 0 best solutions below