Using a Skeleton with Skeletonhelper

ぃ、小莉子 提交于 2019-12-13 21:07:45

问题


So I've been trying to use the SkeletonHelper to render a basic skeleton for an animation visualizer, but can't figure out how to get SkeletonHelper to accept the Skeleton variable armSkeleton I pass into the constructor. The documentation states that the SkeletonHelper does accept Skeleton type objects, which is causing me much grief. The console error I get is "TypeError: object.children is undefined". Could anyone point me in the right direction as to fixing this?

        var bones = [];
        var shoulder = new THREE.Bone();
        var elbow = new THREE.Bone();
        var hand = new THREE.Bone();

        shoulder.add( elbow );
        elbow.add( hand );

        bones.push( shoulder );
        bones.push( elbow );
        bones.push( hand );

        shoulder.position.y = -5;
        elbow.position.y = 0;
        hand.position.y = 5;

        armSkeleton = new THREE.Skeleton( bones );
        var helper = new THREE.SkeletonHelper(armSkeleton); <Error at this line>

回答1:


SkeletonHelper does not accept a skeleton as the constructor parameter. In your case, you have to pass in the top most bone. Have a look at the following example for more information:

https://jsfiddle.net/f2Lommf5/13483/



来源:https://stackoverflow.com/questions/52231144/using-a-skeleton-with-skeletonhelper

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!