简体   繁体   English

Three.js ColladaLoader“无法读取未定义的属性'length'”

[英]Three.js ColladaLoader “Cannot read property 'length' of undefined”

I'm trying to repeat the kinematics example found here: 我试图重复在这里找到的运动学示例:

https://threejs.org/examples/#webgl_loader_collada_kinematics https://threejs.org/examples/#webgl_loader_collada_kinematics

If I use the collada provided in the example everything is fine. 如果我使用示例中提供的collada,一切都很好。 However, if I'm using my own collada, I'm getting the "length" error at line 138 (I'm using the exact same code for now): 但是,如果我使用自己的collada,则会在第138行收到“长度”错误(我现在使用的是完全相同的代码):

https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_collada_kinematics.html https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_collada_kinematics.html

Anyone have an idea why? 有人知道为什么吗?

From an answer I got on the Three.js github, my dae file does not contain any kinematic information (so tags like library_kinematics_models or library_kinematics_scenes) but just a simple armature (skeletal animation). 从我在Three.js github上得到的答案中,我的dae文件不包含任何运动学信息(因此,诸如library_kinematics_models或library_kinematics_scenes之类的标签)而只是一个简单的骨架(骨骼动画)。 I knew that, but I thought kinematic was to get access to joints and everything. 我知道这一点,但我认为运动学是要接触关节和所有事物。 So since it does not contain any animation data, I'll only able to statically display it using Collada Loader. 因此,由于它不包含任何动画数据,因此我只能使用Collada Loader静态显示它。

Edit: If the loader detects a skin and bone hierarchy, it returns the corresponding mesh as a SkinnedMesh under children (for me it was children[1]). 编辑:如果加载程序检测到皮肤和骨骼的层次结构,它将在子下返回相应的网格作为SkinnedMesh (对我来说,它是children [1])。 This object has a skeleton property that provides access to all bones. 该对象具有可访问所有骨骼的骨架属性。

After, you have to create an animation using the Animation System . 之后,您必须使用Animation System创建动画。

For more information, you can refer to my post on the Three.js discourse. 有关更多信息,您可以参考我在Three.js论述中的帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM