Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript can';t open gltf file with three.js返回错误,对于GLTFLoader.js返回错误,对于three.js返回加载_Javascript_Three.js - Fatal编程技术网

Javascript can';t open gltf file with three.js返回错误,对于GLTFLoader.js返回错误,对于three.js返回加载

Javascript can';t open gltf file with three.js返回错误,对于GLTFLoader.js返回错误,对于three.js返回加载,javascript,three.js,Javascript,Three.js,我从three.js开始,试图打开一个glTF 3d模型。我使用Xampp作为本地服务器和Firefox。脚本本身在控制台中没有问题,但仍然无法工作。控制台返回: error ​ bubbles: false ​ cancelBubble: false ​ cancelable: false ​ composed: false ​ currentTarget: null ​ defaultPrevented: false ​ eventPhase: 0 ​ explicitOriginalTar

我从three.js开始,试图打开一个glTF 3d模型。我使用Xampp作为本地服务器和Firefox。脚本本身在控制台中没有问题,但仍然无法工作。控制台返回:

error
​
bubbles: false
​
cancelBubble: false
​
cancelable: false
​
composed: false
​
currentTarget: null
​
defaultPrevented: false
​
eventPhase: 0
​
explicitOriginalTarget: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
​
isTrusted: true
​
lengthComputable: false
​
loaded: 0
​
originalTarget: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
​
returnValue: true
​
srcElement: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
​
target: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
​
timeStamp: 121
​
total: 0
​
type: "error"
​
<get isTrusted()>: function isTrusted()
​
<prototype>: ProgressEventPrototype { lengthComputable: Getter, loaded: Getter, total: Getter, … }
GLTFLoader.js:89:14
    _onError http://localhost/3d/GLTFLoader.js:89
    load http://localhost/3d/three.js:26843
这是我的html代码:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Three.js Crash Course</title>
        <style>
            body {margin: 0;}
            canvas {width: 100%; height: 100%;}
        </style>
    </head>

    <body>
        <div class="scene"></div>
        <script src='3d/three.js'></script>
        <script src='3d/GLTFLoader.js'></script>
        <script src='3d/3d.js' dever></script>
        <!--<script src='3d/jav.js'></script>-->
    </body>

</html>

3.js速成班
正文{页边距:0;}
画布{宽度:100%;高度:100%;}

提前感谢您的帮助。

请尝试使用相对URL,而不是指定本地目录的绝对文件路径。对不起,请您更准确地解释一下,我应该写什么以及在哪里写。非常感谢你
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Three.js Crash Course</title>
        <style>
            body {margin: 0;}
            canvas {width: 100%; height: 100%;}
        </style>
    </head>

    <body>
        <div class="scene"></div>
        <script src='3d/three.js'></script>
        <script src='3d/GLTFLoader.js'></script>
        <script src='3d/3d.js' dever></script>
        <!--<script src='3d/jav.js'></script>-->
    </body>

</html>