I have exported a glTF file from Blender (3.0) to Three.js (r136). In the file I include a custom prop which is an array of vertices indexes.
I simply want to modify the geometry of an object in the fly in Blender. For now, I do this:
C.active_object['movable'] = [v.index for v in C.active_object.data.vertices if v.select]
In the result I get:
"extras" : {
"movable" : [
0,
1,
...]}
After export to *.gltf and importing the file, I have my data in <Mesh>.userData["movable"]:
[0, 1, 2, 3, 4, 5, 6, 7, 136, 139, 141, 142, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 185]
My problem:
for (el of <Array>) {
var x = el*3 + 0;
var y = el*3 + 1;
var z = el*3 + 2;
<Mesh>.geometry.attributes.position.array[z] += 0.1;
};
<Mesh>.geometry.attributes.position.needsUpdate = true;
After applying this code, the wrong vertices is moved.
What am I doing wrong?