Mesh vertex update

li.refreshBoundingInfo(true) is not effect

var points = []
    for (var i = 0; i < 100; i++) {
        // This is the effect I want, but I don't want to do it like this
        // points.push(new BABYLON.Vector3(i - 50, 5 * Math.sin(i / 5) + 10, 5 * Math.cos(i / 5))) 
        

        points.push(new BABYLON.Vector3(i - 50, 5 * Math.sin(i / 5), 5 * Math.cos(i / 5)))
    }


    var path3d = new BABYLON.Path3D(points)
    var curve = path3d.getCurve()
    var li = BABYLON.Mesh.CreateLines('li', curve, scene)
    li.position.y = 10

    // This update is not working,I know it needs to update all vertices,
    // mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, positions);
    // But this calculation is quite complicated
    li.refreshBoundingInfo(true)

What do you mean by “not working”?

This line of code cannot update mesh vertex coordinates

var li = BABYLON.Mesh.CreateLines('li', curve, scene)

li.position.y = 10


do somethin update mesh vertex,

You are changing the position of a mesh and you want to update its bounding info?

yes, it’s like this

When you update the position property of a mesh, you aren’t updating its vertices positions, instead, you’re updating its transformation matrix. This is reflected on the bounding information, where you both have the min/max in vertex space, and in world space: BoundingBox | Babylon.js Documentation (babylonjs.com), which will take the transformation matrix into account.

1 Like

Yes, it’s exactly what I thought

Does this answer your question? :slight_smile:

thank you

1 Like