I’m looking for a solution to load different animations by button. so I removed the animation array “morphTargets” from the JSON script “horse.js” and written it into a separate JSON script. Now I try to reload and delete. Does anyone know how to do that?
Animation array greatly shortened.
function myFunction() {
var oldArray = [
{ "name": "horse_A_001", "vertices": [0,1389,54,0,1408,116,0,1372] },
{ "name": "horse_A_002", "vertices": [0,1408,54,0,1425,111,0,1413] },
{ "name": "horse_A_003", "vertices": [0,1442,55,0,1456,105,0,1470] },
{ "name": "horse_A_004", "vertices": [0,1480,55,0,1490,99,0,1530] },
{ "name": "horse_A_005", "vertices": [0,1515,56,0,1520,92,0,1582] },
{ "name": "horse_A_006", "vertices": [0,1542,55,0,1542,87,0,1618] },
{ "name": "horse_A_007", "vertices": [0,1555,54,0,1550,87,0,1633] },
{ "name": "horse_A_008", "vertices": [0,1558,52,0,1550,92,0,1628] },
{ "name": "horse_A_009", "vertices": [0,1555,50,0,1552,104,0,1614] },
{ "name": "horse_A_010", "vertices": [0,1521,48,0,1527,118,0,1574] }
],
var newArray = oldArray.slice();
//var nweArray = oldArar.concat(); // concat can also be used to copy
console.log( newArray );
}
The original horse.js without animation array
"metadata" : {
"formatVersion" : 3,
"description" : "3D assets and textures for ROME - 3 Dreams of Black - at http://ro.me are licensed under a Creative CommonsAttribution-NonCommercial-ShareAlike 3.0 Unported License ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )."
},
"scale" : 10.000000,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "comp_horse_rig:blinn9SG",
"colorDiffuse" : [0.41999999999999998, 0.56999999999999995, 0.45000000000000001],
"colorSpecular" : [1.0, 0.42999999999999999, 0.35999999999999999],
"illumination" : 4,
"opticalDensity" : 1.0
}],
"vertices": [0,1389,54,0,1408,116,0,1372],
"morphTargets": [ ],
"morphColors": [
{ "name": "horse_colorMap", "colors": [0.650,0.360,0.220,0.650,0.360,0.220] }
],
"normals": [],
"colors": [],
"uvs": [[0.448620,0.529399,0.416272,0.497377]],
"faces": [10,53,51,49,0,4,2,0,10,49,51,50]
}