Hi,
there is an error when I try to drag points on the screen. The ID is always the same so it keeps dragging the wrong value. The sphereID is always 2 after I add 3 points.
var dragCallback = function(event) {
let dataOutput = api.scene.getData({
name: “ProjectedPoints”
}).data[0].data;
if (!Array.isArray(dataOutput)) dataOutput=[dataOutput];
points = ;
for (let i = 0; i < dataOutput.length; i++) {
points.push(JSON.parse(dataOutput[i]));
}
console.log(“points”,points);
// find which sphere was selected
let sphereID = event.scenePath.split(".")[1];
console.log(“sphereID”,event.scenePath);
let sphereAsset = api.scene.get({
id: sphereID
}, “CommPlugin_1”);
selectedSphere = sphereAsset.data[0].name.split("_")[1];
console.log("sphereIDNAME", sphereAsset.data[0].name);
let newPos = event.dragPosAbs;
points[selectedSphere][0] += newPos.x;
points[selectedSphere][1] += newPos.y;
points[selectedSphere][2] += newPos.z;
api.parameters.updateAsync({
name: “Points”,
value: JSON.stringify({
‘points’: points
})
});
};