react-three-fiber icon indicating copy to clipboard operation
react-three-fiber copied to clipboard

Unable to load GLTF on react native expo

Open ktjh123 opened this issue 3 years ago • 4 comments
trafficstars

Hi

Is there a bug with the drei's gltf loader on react native?

Cant seem to load a gltf model

import React, { useRef } from 'react'
import { useGLTF } from '@react-three/drei/native'

export default function Rain(props) {
  console.log('rendering rain')
  const group = useRef()
  const { nodes, materials } = useGLTF('/character.gltf')
  console.log('nodes')
  console.log(nodes)
  
  var meshes =[]
  for(var key in nodes)
  {
    
    meshes.push(<mesh

      material={nodes[key].material}
      geometry={nodes[key].geometry}
    />)
  }
  console.log('meshes')
  console.log(meshes)
  return (
    <group ref={group} {...props} dispose={null}>
        {meshes}
    </group>
  )
}

useGLTF.preload('/assets/character')

[Unhandled promise rejection: Error: Resource ID #0x0]

ktjh123 avatar Jun 16 '22 08:06 ktjh123

Did you find the solution?

dpsilvaa97 avatar Jul 04 '22 09:07 dpsilvaa97

When I tried to use useGLTF i get and error "ReferenceError: Can't find variable: crypto"

dpsilvaa97 avatar Jul 04 '22 09:07 dpsilvaa97

Nope have not found a solution

ktjh123 avatar Jul 05 '22 07:07 ktjh123

Can you post a recreation? This might be related to #1972 where GLTFLoader will fail when loading models with textures due to unimplemented features like Blob => ArrayBuffer.

CodyJasonBennett avatar Aug 02 '22 15:08 CodyJasonBennett

@dpsilvaa97, I'd create a separate issue for that error, but I'm merging this issue with #1972 since this comes from GLTFLoader's texture path.

CodyJasonBennett avatar Sep 02 '22 01:09 CodyJasonBennett