Javascript 未捕获异常:在a帧中使用Draco解码器加载glTF模型时的对象
我正在尝试加载glitch.com中使用的glTF模型,如下所示。您可以查看完整的项目和代码。当我在本地运行代码时,一切正常,但当我运行glitch.com应用程序时,浏览器控制台中出现未捕获的异常:Object 3错误。这是我正在使用的HTML:Javascript 未捕获异常:在a帧中使用Draco解码器加载glTF模型时的对象,javascript,html,aframe,gltf,Javascript,Html,Aframe,Gltf,我正在尝试加载glitch.com中使用的glTF模型,如下所示。您可以查看完整的项目和代码。当我在本地运行代码时,一切正常,但当我运行glitch.com应用程序时,浏览器控制台中出现未捕获的异常:Object 3错误。这是我正在使用的HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Chait
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chaitén VR 3</title>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="scripts/camera-listener.js"></script>
</head>
<body>
<a-scene
stats
renderer="antialias: true; colorManagement: true; sortObjects: true; physicallyCorrectLights: true; maxCanvasWidth: 1920; maxCanvasHeight: 1920;"
gltf-model="dracoDecoderPath: scripts/draco_decoder">
<a-assets timeout="69000">
<a-asset-item
id="cave"
src="https://cdn.glitch.com/b8b66d5a-73ec-4bfe-8bfc-6ac0f5e30e89%2Fcueva_6_dcompress_1.gltf">
</a-asset-item>
</a-assets>
<a-sky
color="#000">
</a-sky>
<a-gltf-model
src="#cave"
scale="1 1 1"
position="0 0 -10"
rotation="-90 90 0"
shadow="cast: true"
sound="src: https://cdn.glitch.com/b8b66d5a-73ec-4bfe-8bfc-6ac0f5e30e89%2Fcave_1.mp3; autoplay: true; loop: true; volume: 2">
</a-gltf-model>
<a-entity
id="camera"
camera
look-controls
wasd-controls="acceleration:150"
position="-4.5 1.6 -1">
</a-entity>
<a-entity
id="light"
light="type: point; intensity: 15; distance: 10; decay: 1; shadowCameraVisible: false;"
position="-4.5 1.6 0.35">
</a-entity>
<a-entity camera-listener></a-entity>
</a-scene>
</body>
柴登VR 3
要将模型转换为Draco glTF。我检查了此文件:并发现:
// It is recommended to always pull your Draco JavaScript and WASM decoders
// from this URL. Users will benefit from having the Draco decoder in cache
// as more sites start using the static URL.
let decoderPath = 'https://www.gstatic.com/draco/v1/decoders/';
我使用了该路径,现在应用程序运行正常。我检查了此文件:并发现:
// It is recommended to always pull your Draco JavaScript and WASM decoders
// from this URL. Users will benefit from having the Draco decoder in cache
// as more sites start using the static URL.
let decoderPath = 'https://www.gstatic.com/draco/v1/decoders/';
我使用了该路径,现在应用程序运行正常。谢谢。这修复了“意外令牌<在JSON中”错误,该错误阻止加载draco glb。谢谢。这修复了阻止加载draco glb的“意外标记<在JSON中”错误。