使用Forge AR/VR Toolkit加载时模型不完整 [英] Model incomplete when loading with Forge AR/VR Toolkit

查看:78
本文介绍了使用Forge AR/VR Toolkit加载时模型不完整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IFC模型,并且在场景准备"中使用了示例脚本"test-2legged"(

提前谢谢!

解决方案

对于遇到类似问题的任何人,仿射如何从带有以下代码的开关盒:

 案例"AffineMatrix":Matrix4x4 mat =新的Matrix4x4();var elements = node ["mt"] ["elements"].AsArray;mat.m00 = elements [0] .AsFloat;mat.m10 = elements [1] .AsFloat;mat.m20 = elements [2] .AsFloat;mat.m01 = elements [3] .AsFloat;mat.m11 = elements [4] .AsFloat;mat.m21 = elements [5] .AsFloat;mat.m02 = elements [6] .AsFloat;mat.m12 = elements [7] .AsFloat;mat.m22 = elements [8] .AsFloat;mat.m03 = node ["tr"] ["x"].AsFloat;mat.m13 = node ["tr"] ["y"].AsFloat;mat.m23 = node ["tr"] ["z"].AsFloat;mat.m33 = 1.0f;obj.transform.localScale = ScaleFromMatrix(mat);obj.transform.rotation = RotationFromMatrix(mat);obj.transform.position = TranslationFromMatrix(mat);休息; 

I have an IFC model, and I use the sample script 'test-2legged' in Scene Preparation (http://forgetoolkit.com/#/scenePrepration) to upload it to Forge. Then I loaded it with AR/VR toolkit (ForgeARKit-update-6-2018.1). However the downloaded model is incomplete (see below pictures). There is no external links in the model.

Please also note that I did some minor modification in 'test-2legged', as the original sample does not work directly with the new beta server 'https://developer-api-beta.autodesk.io' (please refer to another post: Forge ARKit: Cannot load model in Unity).

It seems for some components in the model it is visible but for some others it 's not, one thing I noticed is that some components has non-Unicode(Finnish) value in properties such as Type/Type name, not sure if that is the root-cause.

Can anyone help to check what can be wrong? I can upload the sample model.

Thank you in advance!

解决方案

For anyone running into a similar issue, there was a problem with how affine transforms from https://developer-api-beta.autodesk.io were being parsed in Unity. If you're seeing similar issues (meshes in the scene having positions/rotations/scales all set to zeros), go to Assets/Forge/CodeBase/InstanceTreeRequest.cs and replace the "AffineMatrix" switch case with the following code:

case "AffineMatrix":
    Matrix4x4 mat = new Matrix4x4 ();

    var elements = node["mt"]["elements"].AsArray;
    mat.m00 = elements[0].AsFloat;
    mat.m10 = elements[1].AsFloat;
    mat.m20 = elements[2].AsFloat;
    mat.m01 = elements[3].AsFloat;
    mat.m11 = elements[4].AsFloat;
    mat.m21 = elements[5].AsFloat;
    mat.m02 = elements[6].AsFloat;
    mat.m12 = elements[7].AsFloat;
    mat.m22 = elements[8].AsFloat;

    mat.m03 = node["tr"]["x"].AsFloat;
    mat.m13 = node["tr"]["y"].AsFloat;
    mat.m23 = node["tr"]["z"].AsFloat;
    mat.m33 = 1.0f;

    obj.transform.localScale = ScaleFromMatrix (mat);
    obj.transform.rotation = RotationFromMatrix (mat);
    obj.transform.position = TranslationFromMatrix (mat);
    break;

这篇关于使用Forge AR/VR Toolkit加载时模型不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆