Mesh Component

It is important to note that you update the resource in your example.
If all meshes use that same resource, then it won’t work as you intended.

Instead, you can create a new buffer resource dynamically, and assign it:

local newBuff = buffer.create(...) -- as you do now
local resource_name = "/my_cloned_buffer.bufferc" -- make this unique for each resource!
local buffer_resource = reource.create_buffer(resource_name, { buffer = newBuff })
go.set(url, "vertices", buffer_resource) -- replace it's current resource hash, with the new one

Note, read the documentation! E.g. the name of the resource must be unique!
I.e. they can’t all be named /my_cloned_buffer.bufferc

3 Likes