Fail to update vertex buffer of an Imported GLTF file

Hi,

I am now trying to access the mesh’s vertex buffer and change the vertices’ positions. It can be done on a sphere created by MeshBuilder.CreateSphere, but fails for a mesh imported by SceneLoader.ImportMesh (such as a .gltf file).

Really confused now… Are there any extra steps to update an imported mesh?

Below is a playground to demonstrate this, in which the sphere is successfully changed but the skull is not.

Thanks,
Kimi

I’ve checked the code and it looks like geometry loaded by gltfloader is not updatable. I guess you can clone and swap the Geometry to make it updatable.
cc @bghgary

You should use setVerticesData instead of updateVerticesData, which only works if the buffer has been created as updatable in the first place.

2 Likes

Maybe we can add a flag to tell the loader to use updatable buffers?

3 Likes

@KimiZhong If you want this, please file a feature request on GitHub. :slight_smile: