expo-three
expo-three copied to clipboard
Cannot parse a null asset
Full warning: [Unhandled promise rejection: Error: ExpoTHREE.loadObjAsync: Cannot parse a null asset]
- node_modules\expo-three\build\loaders\loadModelsAsync.js:10:14 in loadFileAsync$
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:271:30 in invoke
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:135:28 in invoke
- node_modules\regenerator-runtime\runtime.js:170:17 in
- node_modules\promise\setimmediate\core.js:45:7 in tryCallTwo
- node_modules\promise\setimmediate\core.js:200:23 in doResolve
- node_modules\promise\setimmediate\core.js:66:12 in Promise
- node_modules\regenerator-runtime\runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules\regenerator-runtime\runtime.js:192:38 in enqueue
- node_modules\regenerator-runtime\runtime.js:216:8 in
- node_modules\expo-three\build\loaders\loadModelsAsync.js:8:0 in loadFileAsync
- node_modules\expo-three\build\loaders\loadModelsAsync.js:38:36 in loadObjAsync$
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:271:30 in invoke
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:135:28 in invoke
- node_modules\regenerator-runtime\runtime.js:170:17 in
- node_modules\promise\setimmediate\core.js:45:7 in tryCallTwo
- node_modules\promise\setimmediate\core.js:200:23 in doResolve
- node_modules\promise\setimmediate\core.js:66:12 in Promise
- node_modules\regenerator-runtime\runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules\regenerator-runtime\runtime.js:192:38 in enqueue
- node_modules\regenerator-runtime\runtime.js:216:8 in
- node_modules\expo-three\build\loaders\loadModelsAsync.js:28:7 in loadObjAsync
- components\3D\test.js:67:51 in _callee$
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:271:30 in invoke
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:135:28 in invoke
- node_modules\regenerator-runtime\runtime.js:170:17 in
- node_modules\promise\setimmediate\core.js:45:7 in tryCallTwo
- node_modules\promise\setimmediate\core.js:200:23 in doResolve
- node_modules\promise\setimmediate\core.js:66:12 in Promise
- node_modules\regenerator-runtime\runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules\regenerator-runtime\runtime.js:192:38 in enqueue
- node_modules\regenerator-runtime\runtime.js:216:8 in
- components\3D\test.js:36:20 in _callee
- node_modules\expo-graphics\lib\GraphicsView.ios.js:180:25 in _callee$
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:271:30 in invoke
- node_modules\regenerator-runtime\runtime.js:45:44 in tryCatch
- node_modules\regenerator-runtime\runtime.js:135:28 in invoke
- node_modules\regenerator-runtime\runtime.js:170:17 in
- node_modules\promise\setimmediate\core.js:45:7 in tryCallTwo
- node_modules\promise\setimmediate\core.js:200:23 in doResolve
- node_modules\promise\setimmediate\core.js:66:12 in Promise
- node_modules\regenerator-runtime\runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules\regenerator-runtime\runtime.js:192:38 in enqueue
- node_modules\regenerator-runtime\runtime.js:216:8 in
- node_modules\expo-graphics\lib\GraphicsView.ios.js:141:21 in _callee
- node_modules\expo-graphics\lib\GLView.js:22:26 in onContextCreate
- node_modules\expo-gl\build\GLView.js:25:43 in
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:93:15 in invokeGuardedCallbackImpl
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:318:36 in invokeGuardedCallback
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:342:30 in invokeGuardedCallbackAndCatchFirstError
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:715:42 in executeDispatch
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:737:20 in executeDispatchesInOrder
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:894:29 in executeDispatchesAndRelease
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:876:12 in forEachAccumulated
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:1050:21 in runEventsInBatch
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:1072:19 in runExtractedEventsInBatch
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2708:6 in
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18527:14 in batchedUpdates$1
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2611:31 in batchedUpdates
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2706:17 in _receiveRootNodeIDEvent
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2726:26 in receiveEvent
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:366:47 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:106:26 in
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:105:17 in callFunctionReturnFlushedQueue
- [native code]:null in callFunctionReturnFlushedQueue
Code: `import { View as GraphicsView } from 'expo-graphics'; import ExpoTHREE, { THREE } from 'expo-three'; import React from 'react';
import PanResponder from 'react-native';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; import Animated from 'react-native-reanimated'; import { TouchableHighlight, TouchableOpacity } from 'react-native-gesture-handler'; var theta = 0; var radius = 100; var raycaster; var mouse = new THREE.Vector2(), INTERSECTED; export default class Body extends React.Component { componentWillMount() { THREE.suppressExpoWarnings(); }
render() {
// Create an ExpoGraphics.View
covering the whole screen, tell it to call our
// onContextCreate
function once it's initialized.
return (
<GraphicsView
onContextCreate={this.onContextCreate}
onRender={this.onRender}
/>
);
}
// This is called by the ExpoGraphics.View
once it's initialized
onContextCreate = async ({
gl,
canvas,
width,
height,
scale: pixelRatio,
}) => {
this.renderer = new ExpoTHREE.Renderer({ gl, pixelRatio, width, height });
this.renderer.setClearColor(0xffffff);
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
this.camera.position.z = 6;
//var loader = new THREE.GLTFLoader();
// loader.load('soccerball.obj', function(object){
// this.scene.add(object);
// },
// function ( xhr ) {
// console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
// },
// // called when loading has errors
// function ( error ) {
// console.log( 'An error happened', error );
// });
//const geometry = new THREE.BoxGeometry(3, 3, 3);
// const geometry1 = new THREE.SphereGeometry(1, 10, 10);
const geometry = await ExpoTHREE.loadObjAsync(require('../../assets/objects/soccerball.obj'));
const material = new THREE.MeshBasicMaterial({
color: 0xff0000,
});
// this.sph = new THREE.Mesh(geometry1, material);
this.cube = new THREE.Mesh(geometry, material);
// // this.cube = await ExpoTHREE.loadObjAsync({ asset: require('./Person.obj') });
this.scene.add(this.cube);
this.scene.add(new THREE.AmbientLight(0x404040));
const light = new THREE.DirectionalLight(0xffffff, 0.5);
light.position.set(3, 3, 3);
this.scene.add(light);
};
onRender = delta => {
this.cube.rotation.x += 0 * delta;
this.cube.rotation.y += .3 * delta;
this.renderer.render(this.scene, this.camera);
};
}`
I have this same exact problem as well. Do hope someone answers.