vue-babylonjs icon indicating copy to clipboard operation
vue-babylonjs copied to clipboard

Creating Ribbon - path[j].subtract function not found

Open Zohair1234 opened this issue 3 years ago • 0 comments

I created an array of Vector3 arrays for Ribbon but while displaying the ribbon, it gives me an error in path[j].subtract() function. On digging deeper into the code for vue-babylonjs, I found the subtract() function being used:

for (p = 0; p < pathArray.length; p++) {
       uTotalDistance[p] = 0;
       us[p] = [0];
       path = pathArray[p];
       l = path.length;
       minlg = (minlg < l) ? minlg : l;
       j = 0;
       while (j < l) {
           positions.push(path[j].x, path[j].y, path[j].z);
           if (j > 0) {

               **vectlg = path[j].subtract(path[j - 1]).length();**
             
               console.log('vectlg', vectlg);
               dist = vectlg + uTotalDistance[p];
               us[p].push(dist);
               uTotalDistance[p] = dist;
           }
           j++;
       }

subtract() function is not used in javascript as far as I have dug in the documentation. I would like to know the function of that line of code so I can replace it with familiar javascript code that is able to run it without any problems while having the same effect.

Zohair1234 avatar Jan 19 '21 13:01 Zohair1234