Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Animation 搅拌机出口&引用;动画";丢失的_Animation_Three.js_Blender - Fatal编程技术网

Animation 搅拌机出口&引用;动画";丢失的

Animation 搅拌机出口&引用;动画";丢失的,animation,three.js,blender,Animation,Three.js,Blender,我试图弄清楚基本动画是如何导出并与three.js一起使用的。我在blender中创建了一个几何体并将其导出到JSON。由于我使用的是three.js v 69,因此不推荐使用three.animationHandler。我为我的库版本找到了一个工作示例,但它仅适用于随three.js库提供的示例附带的JSON:。 我的JSON文件输出此错误:TypeError:a未定义三。min.js:682 我找不到文件之间的语法差异 var loader = new THREE.JSONLoader(),

我试图弄清楚基本动画是如何导出并与three.js一起使用的。我在blender中创建了一个几何体并将其导出到JSON。由于我使用的是three.js v 69,因此不推荐使用three.animationHandler。我为我的库版本找到了一个工作示例,但它仅适用于随three.js库提供的示例附带的JSON:。 我的JSON文件输出此错误:
TypeError:a未定义三。min.js:682

我找不到文件之间的语法差异

var loader = new THREE.JSONLoader(),  
    animatedMesh;

loader.load( './123.json', function ( geometry, materials ) {
     var originalMaterial = materials[ 0 ];
    originalMaterial.skinning = true;
    animatedMesh = new THREE.SkinnedMesh( geometry, originalMaterial );
    // Instantiate the animation
    var animation = new THREE.Animation(
        animatedMesh,
        geometry.animation
    );
    animation.play();

});
scene.add( animatedMesh );
当我在加载程序调用的函数中首先检查geometry.animation[0].hierarchy.lenght时,它会在我使用JSON时给出错误信息。当我使用knight.js时,我得到了正确的动画数量;八十

我为测试导出的JSON:

{   "metadata": {
        "formatVersion" : 3.1,
        "generatedBy"   : "Blender 2.7 Exporter",
        "vertices"      : 8,
        "faces"         : 6,
        "normals"       : 8,
        "colors"        : 0,
        "uvs"           : [],
        "materials"     : 1,
        "morphTargets"  : 0,
        "bones"         : 1
    },

        "scale" : 1.000000,

        "vertices" : [0.282971,-0.059365,-0.277163,0.278713,-0.0459321,0.283946,-0.282552,-0.0482188,0.279742,-0.278294,-0.0616519,-0.281367,0.268505,3.65467,-0.366188,0.264248,3.66811,0.194921,-0.297017,3.66582,0.190716,-0.29276,3.65239,-0.370392],
        "faces"    : [35,0,1,2,3,0,0,1,2,3,35,4,7,6,5,0,4,5,6,7,35,0,4,5,1,0,0,4,7,1,35,1,5,6,2,0,1,7,6,2,35,2,6,7,3,0,2,6,5,3,35,4,0,3,7,0,4,0,3,5],
        "uvs"      : [],
        "normals"  : [0.583941,-0.588641,-0.559008,0.575182,-0.560991,0.595325,-0.579455,-0.565691,0.586657,-0.570696,-0.593341,-0.567644,0.579455,0.565691,-0.586657,-0.575182,0.560991,-0.595325,-0.583941,0.588641,0.559008,0.570696,0.593341,0.567644],

        "skinIndices"  : [0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1],
        "skinWeights"  : [1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0],
        "morphTargets" : [],

        "bones"      : [{"parent":-1,"name":"Bone","pos":[0,0,-0],"rotq":[0.707107,0,-0,0.707107],"scl":[3.4158,3.4158,3.4158]}],
        "animation" : [{"name":"ArmatureAction","fps":24,"length":1.625,"hierarchy":[{"parent":-1,"keys":[{"time":0,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.0416667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.0833333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.125,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.166667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.208333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.25,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.291667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.333333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.375,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.416667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.458333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.5,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.541667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.583333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.625,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.666667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.708333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.75,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.791667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.833333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.875,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.916667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":0.958333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.04167,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.08333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.125,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.16667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.20833,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.25,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.29167,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.33333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.375,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.41667,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.45833,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.5,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.54167,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.58333,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]},{"time":1.625,"pos":[0,0,-0],"rot":[0.698582,-0.00125648,0.00407379,0.715517],"scl":[3.4158,3.4158,3.4158]}]}]}],

        "colors"    : [],
        "materials" : [
            {
                "DbgColor": 15658734,
                "DbgIndex": 0,
                "DbgName": "Material",
                "blending": "NormalBlending",
                "colorAmbient": [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
                "colorDiffuse": [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
                "colorEmissive": [0.0, 0.0, 0.0],
                "colorSpecular": [0.5, 0.5, 0.5],
                "depthTest": true,
                "depthWrite": true,
                "shading": "Lambert",
                "specularCoef": 50,
                "transparency": 1.0,
                "transparent": false,
                "vertexColors": false
            }       ]   }

这是我的错误,Blender中有某些条件可以正确导出到JSON。在一些模型中,它的cales动画,在mine中,它的动画。正确的代码是:var animation=new THREE.animation(animatedMesh,geometry.animations[0])

请在问题中包含您的源代码和JSON。请参阅,和。请在问题中包括您的源代码(不是我们必须启用JavaScript并运行代码的页面)和最小JSON(不是1.267MB)。请看,和(MCVE)。创建MCVE的过程通常会让您发现问题所在。这是我的错误,Blender中有某些条件可以正确导出到JSON。在一些模型中,它的cales动画,在mine中,它的动画。正确的代码是:var animation=new THREE.animation(animatedMesh,geometry.animations[0]);如果您有问题的解决方案,请将其添加为答案。然后你可以接受它。你回答自己的问题是完全可以接受的。