没人吗,现在
打卡 打卡 打卡打卡
你好,看了下,是您的 glTF 文件中包含错误——第 9-12 个 accessor 的 bufferView
属性为 -1
;按照 glTF 2.0 规范,bufferView
需要为非负数或 undefined
作为临时解决方案,您可以手动删除这几个 -1 的属性(一共有 4 个)。
如果同样错误的模型很多,您可以尝试联系您的模型导出工具(此模型来看是 Unity glTF 导出工具),或自己批量处理:
const fs = require('fs-extra');
/**
* 修正此贴出现的问题模型。
* @param {string} inFile 问题模型文件路径。
* @param {string} outFile 输出模型文件路径。
*/
async function correct(inFile, outFile) {
const glTF = await fs.readJson(inFile);
const { accessors } = glTF;
if (accessors !== undefined) {
for (const accessor of accessors) {
if (accessor.bufferView < 0) {
delete accessor.bufferView;
}
}
}
await fs.writeJson(outFile, glTF, { spaces: 2 });
}
感谢您的解答,我去试一下
另外,本贴提供的模型中包含一个 顶点数量为 0 的子网格,叫做 mesh_QBlock_13838QBlock
。
Mesh.prototype.readAttribute
和 Mesh.prototype.copyAttribute
在处理 0 顶点子网格时存在问题,导致在将本模型拖入场景中时会报错。此报错不影响预览和构建。
这个问题将在 1.2 中修复,相关 PR:https://github.com/cocos-creator/engine/pull/6988
您好 Unity glTF 2.0 Exporter 我用的是这个导出工具,模型是导出成功了,但是 动画等 资源并没有导出,controller 我也选择了
Animator
试过 我用的2019的不行