Trying to ExpoTHREE.loadObjAsync | Can't find variable: THREE
See original GitHub issueAs soon as I try to run this line of code:
const mesh = await ExpoTHREE.loadObjAsync({asset: require(‘…/assets/models/head.obj’)});
My app starts complaining about this. Everything else is fine. I’ve already got a cube spinning no problem. I’ve dug into this a lot, but it looks like the OBJLoader.js file is complaining that it can’t find THREE.
Is it right that we’re using a file out of the examples folder of three?
what about the seperate package of three-obj-loader? Is that needed?
Can't find variable: THREE
<unknown>
OBJLoader.js:5:6
loadModuleImplementation
require.js:331:6
guardedLoadModule
require.js:197:45
loadObjAsync$
loadModelsAsync.js:48:15
tryCatch
runtime.js:45:44
invoke
runtime.js:271:30
tryCatch
runtime.js:45:44
invoke
runtime.js:135:28
<unknown>
runtime.js:145:19
tryCallOne
core.js:37:14
<unknown>
core.js:123:25
_callTimer
JSTimers.js:152:14
_callImmediatesPass
JSTimers.js:200:17
callImmediates
JSTimers.js:473:30
__callImmediates
MessageQueue.js:337:6
<unknown>
MessageQueue.js:135:6
__guard
MessageQueue.js:314:10
flushedQueue
MessageQueue.js:134:17
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
0 - Stack Overflow
Absolutely a beginner in three.js not sure what causes the two errors. Errors: 1. Can't find variable: THREE line 21:31 frame.html 2. import ......
Read more >Can't Load Obj Model With Textures Using Expo-Three
I'm trying to load OBJ model with MTL and textures using expothree. The issue is that model is loading without textures and it...
Read more >expo-three - npm
Welcome to Expo & Three.JS. Tools for using three.js to create universal 3D experiences | Try it in the browser! GitHub Actions status....
Read more >Three.js Part 8: Loading Models - YouTube
An updated version of export/import workflows between Blender and three.js can be found ...
Read more >How to Import a 3D Blender Object into a Three.js Project as a ...
Navigate to wherever you want to save the file, and hit the “Export glTF 2.0 binary” button.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I installed three-obj-loader
var OBJLoader = require(‘three-obj-loader’); OBJLoader(THREE);
And put this at the top of the file, now it’s working no problem?
Any ideas?
For others getting the
can't find variable: THREE
problem, add the following lines near the beginning of your program:A lot of the code in ThreeJS relies on a global
THREE
variable (unfortunately).