Hi
I have a json file like this:
[
100,
[
[
{
"x": "0.4",
"y": "0",
"z": "0"
},
{
"x": "0.00",
"y": "0.00",
"z": "0.00"
},
0,
false
]
]
]
and my code is:
var pos = new pc.Vec3(itemSpc[0].x, itemSpc[0].y, itemSpc[0].z);
console.log("---[[[ cube Vec3 json : ", itemSpc[0]);
console.log("---[[[ cube Vec3 pos : ", pos);
console.log("---[[[ cube pos : ", itemSpc[0].x, itemSpc[0].y, itemSpc[0].z);
out put is:
---[[[ cube Vec3 json : {x: '0.4', y: '0', z: '0'}
---[[[ cube Vec3 pos : Vec3 {x: '0', y: '.', z: '4'}
---[[[ cube pos : 0.4 0 0
why when i convert json to vec3 its elements (x,y,z) not correct and it looks split the first element “0.4” to ‘0’ ‘. ’ ’ 4’?