All line meshes go missing on camera move

https://www.babylonjs-playground.com/#7A8K68#1

The scene is a bit hacky but show the gist of running into a major issue. Was using a single LinesSystem mesh to generate “lollipops” to meshes. However rotating the camera all lines disappeared. Thought its might be some global culling. Changed all lines to individual meshes and it still happens.
Appears only happen when using the line’s updateMeshPositions; which I need to use to update per frame. Is there another call I’m missing to stop this or am I using it wrong?

It’s because the bounding boxes aren’t being recomputed, you can do

l.refreshBoundingInfo();

to make it work:

https://www.babylonjs-playground.com/#7A8K68#2

instead of using updateMeshPositions(), you could use the parameter instance from MeshBuilder.CreateLines
https://doc.babylonjs.com/api/classes/babylon.meshbuilder#createlines
https://doc.babylonjs.com/babylon101/parametric_shapes#instance-option

@jerome It appears even if you use the instances you still need to call l.refreshBoundingInfo();

yes, that’s true

if your lines are always in the camera frustum, you can also mark them as always active :
line.alwaysSelectAsActiveMesh = true

1 Like