How to modify a custom mesh

I created a custom mesh by using the mesh.setbuffer. But now I want to try and modify this mesh and whenever I try to modify it trough adjusting it’s buffers I get this error:


SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.UnsupportedOperationException: Data has already been sent. Cannot setupData again.
at com.jme3.scene.VertexBuffer.setupData(VertexBuffer.java:391)
at com.jme3.scene.Mesh.setBuffer(Mesh.java:540)


Am I going at this the wrong way or?

What it is saying is that it is not efficient to set the buffer each time you want to change it.

You can get the buffer using Mesh.getBuffer() and then manipulate it, then call updateData() to indicate that you changed the data.

1 Like

Working great, thanks for the help!