- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
问题:
一切正常:我在/GLTF/子文件夹中将我的 FBX 文件转换为 GLTF。
遗憾的是,一些转换后的文件中缺少一些几何体,所以我尝试再次转换我的 FBX 文件,这次是/TEST/。
突然,模型没有加载,从我的 console.log 语句:
console.log( 'An error happened: '+JSON.stringify(error) );
我得到了这个奇怪的无用错误:
An error happened: {"isTrusted":true}
所以我尝试将我的 FBX 文件转换为 .glb,这次转换为/TEST2/并添加一个额外的 console.log 语句:
console.log( 'An error happened: '+JSON.stringify(error, ["message", "arguments", "type", "name"]) );
我仍然得到同样的错误:
An error happened: {"isTrusted":true}
An error happened: {"type":"error"}
加载第一个转换的 gltf 文件仍然有效(来自/GLTF/的文件),但如前所述,有些文件似乎转换不当:它们的某些几何图形丢失。
这些错误是什么?我该如何加载我的模型?
代码:
<script src="../public/js/3DVisualizer/three.js"></script>
<script src="../public/js/3DVisualizer/inflate.min.js"></script>
<script src="../public/js/3DVisualizer/GLTFLoader.js"></script>
<script src="../public/js/3DVisualizer/DracoLoader.js"></script>
<script src="../public/js/3DVisualizer/OrbitControls.js"></script>
<script src="../public/js/3DVisualizer/Detector.js"></script>
<script src="../public/js/3DVisualizer/stats.min.js"></script>
<script src="../public/js/3DVisualizer/TGALoader.js"></script>
//SOME MORE CODE
<script>
// Instantiate a loader
var loader = new THREE.GLTFLoader();
// Optional: Provide a DRACOLoader instance to decode compressed mesh data
THREE.DRACOLoader.setDecoderPath( '../public/js/3DVisualizer/' );
THREE.DRACOLoader.setDecoderConfig( { type: 'js' } );
loader.setDRACOLoader( new THREE.DRACOLoader() );
// Load a glTF resource
loader.load(
// resource URL
'../public/3D/TEST2/'+name+'.glb',
// called when the resource is loaded
function ( gltf ) {
scene.add( gltf.scene );
gltf.animations; // Array<THREE.AnimationClip>
gltf.scene; // THREE.Scene
gltf.scenes; // Array<THREE.Scene>
gltf.cameras; // Array<THREE.Camera>
gltf.asset; // Object
gltf.scene.traverse(function(node) {
if (node instanceof THREE.Mesh) {
frontObject = node;
node.geometry.computeFaceNormals();
node.geometry.computeVertexNormals();
}
});
if (name.includes("...")) {
backObject = gltf.scene;
}
else {
frontObject = gltf.scene;
}
console.log("LOADED")
frontObject.scale.set(45, 45, 45);
backObject.scale.set(45, 45, 45);
let box = new THREE.Box3().setFromObject(frontObject);
let sphere = box.getBoundingSphere();
let centerPoint = sphere.center;
console.log("CENTER POINT X: " + centerPoint.x);
console.log("CENTER POINT Y: " + centerPoint.y);
console.log("CENTER POINT Z: " + centerPoint.z);
centerPoint.y = 150;
var newCoordinate = shootRay(centerPoint, frontObject);
console.log("NEW POINT X: " + newCoordinate.x);
console.log("NEW POINT Y: " + newCoordinate.y);
console.log("NEW POINT Z: " + newCoordinate.z);
backObject.position.set(newCoordinate.x, newCoordinate.y, (newCoordinate.z - 0));
},
// called while loading is progressing
function ( xhr ) {
},
// called when loading has errors
function ( error ) {
console.log( 'An error happened: '+JSON.stringify(error) );
console.log( 'An error happened: '+JSON.stringify(error, ["message", "arguments", "type", "name"]) );
}
);
</script>
我用来从 FBX 转换为 GLTF 的 NPM 包:
https://www.npmjs.com/package/fbx2gltf
错误:
我看到了什么:
Log shows Error object: {"isTrusted":true} instead of actual error data
.NET Cors isTrusted: true error with Angular 5 app
{"isTrusted":true} exception in core.umd.js
编辑:
最佳答案
要调试它,您可以将模型拖到 my debugging viewer 中你会看到这条消息:
Missing texture: M_Med_Soldier_Body_BLACKKNIGHT_n.tga
glTF 和网络浏览器都不支持 TGA 纹理,因此引用它的事实是用于创建此文件的工具中的错误。我建议在 FBX2glTF 上提交错误。
但是,如果您查看模型文件夹,您会看到相同的图像已经作为 PNG 存在(也许 FBX2glTF 转换了它?)。如果您在文本编辑器(我使用的是 Sublime Text)中打开 .gltf
文件并搜索“图像”,您会发现不正确的 TGA 图像引用。将其重命名为 .png
,您将看到我假设的正确结果:
关于javascript - 获取 {"isTrusted":true} error when using GLTFLoader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51839039/
这个问题在这里已经有了答案: Why in Python does "0, 0 == (0, 0)" equal "(0, False)"? (7 个回答) 去年关闭。 代码片段 1: a = Tru
Integer i = 127; Integer j = 127; System.out.println(i == j); System.out.println(i.equals(j)); Integ
我试图用 Python 进行类似下面的代码的比较,但对产生的输出感到困惑。 谁能解释为什么输出是这样的? >>> True, True == True, True (True, True, True)
我们的下拉值是动态的 010100。 你能帮我将这些值转换为 true、false 吗? Offer的值是10100,Reject的值是10111。所以这些需要转换成 10100 = true,fal
我正在测试,如果用户在页面顶部显示一种货币“EUR”和另一种货币“GBP”,那么我期望包含文本“EUR”和页面下方还存在另一个包含文本“GBP”的链接。它包含在一个名为 "nav-tabs au-ta
如何检查数组的所有元素是真值还是假值。 因为以下内容似乎没有做到这一点:_.all([true, true, true], true); 它返回:false? 最佳答案 您应该重新阅读_.every(
C#:我有一个如下所示的字符串变量: string a = "(true and true) or (true or false)"; 这可以是任何东西,它可以变得更复杂,比如: string b
ruby : true == true == true syntax error, unexpected tEQ 对比JavaScript: true == true == true // => tr
这个问题已经有答案了: Equality of truthy and falsy values (JavaScript) (3 个回答) Which equals operator (== vs ==
为什么 R 中的 TRUE == "TRUE" 是 TRUE? R 中是否有与 === 等效的内容? 更新: 这些都返回FALSE: TRUE == "True" TRUE == "true" TRU
简单的查询,可能不可能,但我知道那里有一些聪明的人:) 给定一个 bool 参数,我希望定义我的 where 子句来限制特定列的输出 - 或不执行任何操作。 因此,给定参数@bit = 1,结果将是:
编写 Excel 公式时,将值设置为 true、“true”还是 true() 是否有区别? 换句话来说,以下哪一个是最好的?还是要看具体情况? if (A1 = 1, true, false) if
如果我们评估这个:TRUE AND TRUE,为什么会这样? 'yes' : 'no' 等于 TRUE 但不等于 yes 何时评估:(TRUE AND TRUE) ? 'yes' : 'no' 等于
这个问题在这里已经有了答案: Behaviour of and operator in javascript [duplicate] (1 个回答) 关闭 7 年前。 如题所说,我不太明白为什么(t
我有一个包含 FromDate 、 ToDate 、 VendorName 和 GoodsName 的表单,一旦一切为真,我需要显示结果 示例: FromDate="11/20/2019"、ToDat
我最近参加了 Java 的入门测试,这个问题让我很困惑。完整的问题是: boolean b1 = true; boolean b2 = false; if (b2 != b1 != b2) S
我有一个模型,我有: ipv4_address = models.IPAddressField(verbose_name=_('ipv4 address'), blank=True, null=Tru
False in [True,True] False in pd.Series([True,True]) 第一行代码返回False第二行代码返回 True! 我想我一定是做错了什么或者遗漏了什么。当我
我可以在 Coq 中证明以下内容吗? Lemma bool_uip (H1 : true = true): H1 = eq_refl true. 即true = true 的所有证明都相同吗? 例如
如果我的理解是正确的,他们做的事情完全一样。为什么有人会使用“for”变体?仅仅是味道吗? 编辑:我想我也在考虑 for (;;)。 最佳答案 for (;;) 通常用于防止编译器警告: while(
我是一名优秀的程序员,十分优秀!