getVerticesData - ColorKind is undefined after geometry.updateVerticesDataDirectly

To reproduce :

  • Open dev tool to see the number of colors logged in the console
  • Click on the sphere or the ground to change some colors
  • The number of colors become undefined in the console.

Description :

  • mesh.getVerticesData(VertexBuffer.ColorKind) is defined (L 59) until a call to mesh.geometry.updateVerticesDataDirectly(BABYLON.VertexBuffer.ColorKind, data) (L 49) is made.
  • Even if mesh.getVerticesData(VertexBuffer.ColorKind) is undefined we can still call mesh.geometry.updateVerticesDataDirectly successfully.

I didn’t dive into the code too deep TBH, but i would suggest against updating the webgl buffer directly. instead you can do this - VerticesData Color undefined after updateVerticesDataDirectly | Babylon.js Playground (babylonjs-playground.com)

Thank you very much @RaananW

The app I’m working on is very sensitive in term of performance so every ms is important and I believed that updating the whole buffer will have an impact, that’s why I tried to use updateVerticesDataDirectly but it seems more or less the same duration than setVerticesData.

Just make sure to mark your mesh updatable :slight_smile: