Building a tube from array when returning to former point won't render the tube

HI,

I’m creating a tube dynamically based on points from an array that is calculated on the fly finding a route, in some cases the point is repeated and the tube will return to a prior point as it finds a blocker, when this happens, the tube is not rendered after that point.

This is an example of an array that causes the behaviour, position 0 and 3 are repeated:

       var myPathTmp = [];
        myPathTmp[0] = new BABYLON.Vector3(2.273655652999878, 0.5, 1.9416018724441528);
        myPathTmp[1] = new BABYLON.Vector3(2.680851459503174, 0.5, 2.4170844554901123);
        myPathTmp[2] = new BABYLON.Vector3(2.273655652999878, 0.5, 1.9416018724441528);
        myPathTmp[3] = new BABYLON.Vector3(2.1215269565582275, 0.5, 2.6639657020568848);

tube = BABYLON.MeshBuilder.CreateTube(“tube”, {path: myPathTmp, radius: 0.02, sideOrientation: BABYLON.Mesh.DOUBLESIDE, updatable: true}, scene);
tube.material = myMaterial;

This code won’t render the tube from array position 2 to 3.

If I remove the point myPathTmp[2]:
var myPathTmp = [];
myPathTmp[0] = new BABYLON.Vector3(2.273655652999878, 0.5, 1.9416018724441528);
myPathTmp[1] = new BABYLON.Vector3(2.680851459503174, 0.5, 2.4170844554901123);
myPathTmp[2] = new BABYLON.Vector3(2.1215269565582275, 0.5, 2.6639657020568848);

It renders the tube correctly. In this case Vector3 on position 1 is not repeated.

In my case the array is dynamically generated as it is finding a route.

Do you think this is a bug or a setting on the CreateTube that I need to set?

Thanks for your valuable help.

The tube geometry is built upon the mathemical object Path3D : Path3D - Babylon.js Documentation

example : Use Path3D - Babylon.js Documentation
Display Path3D Curve - Babylon.js Documentation

It’s probably not surprising that getting back on your path will generate some weird things in your tube…

Thanks for the reply. If I use the line it renders it correctly. But line doesn’t have width parameter :frowning: