Extending a Merged Mesh

Hi All,

New to the Babylon environment and running into a snag with what I’m trying to achieve

Goal:
Have a pipe that changes colors of segments that have curvatures sharper than a 45* angle, as well as be able to grow dynamically.

I can achieve this by recreating the whole pipe each time but this seems rather inefficient to me, so I’m attempting to update a Merged Mesh with a new segment of the pipe.

I’ve tried creating a completely new part of the tube then merging that into the existing tube but this appears to mess up the color of the new segment, because I need to move back the first part the path to make it look like its connected.

I’ve also tried to use the MeshBuilder with the instance of the merged mesh but I get an error that the path3d is null when it reaches the update segment in TubeBuilder.ts:

tubeBuilder.ts:135 Uncaught TypeError: Cannot read property ‘path3D’ of null
at Function.TubeBuilder.CreateTube (tubeBuilder.ts:135)

Here is a PG (https://playground.babylonjs.com/#IM7ZXJ#2) This currently runs the first example solution I mentioned and has the second commented out at lines (111-118).

Is there a better way to achieve my goal, then re creating the whole pipe with a new path?

Many thanks :blush:

Wade

With the way the data are modified I would consider your data safer, but might be good instead of creating lots of tubes to consider extruding along a path ?

Interesting idea, but if the path isn’t separated out into segments ( Creating lots of tubes / extruded paths) Would it still be possible to achieve coloring the corners that have sharp angles?

Here is an example of what I’m trying to achieve, this I can do if I redraw everything recreating all the segments each time a new one is made, when doing it this way though, the new segments alter so each redraw is quite visible.

yup you are right it might be harder to parameterized the color. Maybe manually creating all the vertex data and add vertex colors might be the most efficient solution in your case despite being more tedious.