How to work with dynamic meshes in v3.x

Hello, there is a tutorial how to work with meshes in v 2.4 https://docs.cocos.com/creator/manual/en/3d/mesh.html

How can i create a dynamic mesh in v 3.x?

I can ask engineering to have a look at this topic.

Which version of 3.x are you using?
(There may be slight differences between versions)

I am using v3.3.2.

And one more question. Does Particle System support collisions? Like this: Unity - Manual: Collision module

The particle does not currently support collider yet.

Okay thank you. What about dynamic meshes?

Someone in our Chinese forum has shared a tutorial on how to create it. You can take a look at
https://forum.cocos.org/t/creator-3d-3d/91064

  • Create a mesh dynamically using utils.createMesh

Or, you can check out this file that briefly describes how to create a mesh
line.ts.zip (1.2 KB)

Thank you. But this is not enough. I see that i can create a mesh dynamically. It is ok, but i don’t see how i can update vertices of a mesh.

One way that i found is create a new mesh with updated vertices and set it to a mesh renderer.

Something like this:

update(dt: number) {
    const line: primitives.IGeometry = {
        positions: [
            math.randomRange(-1, 1), math.randomRange(-1, 1), 0, // bottom-left
            math.randomRange(-1, 1), math.randomRange(-1, 1), 0, // top-left
            math.randomRange(-1, 1), math.randomRange(-1, 1), 0, // top-right
            math.randomRange(-1, 1), math.randomRange(-1, 1), 0, // bottom-right
        ],
        indices: [
            0, 3, 1,
            3, 2, 1,
        ]
    };

    let newMesh = utils.createMesh(line)

    this.node.getComponent(MeshRenderer)!.mesh = newMesh
}

Is it ok? Or maybe mesh class has a method to update it?