Best way to change the radius of a Torus?

Hello! Super noob question but I’m wonder what’s the best way to change the outer radius of a Torus. When I try to call updateGeometry() more than once I get this:


java.lang.UnsupportedOperationException: Data has already been sent. Cannot setupData again.

at com.jme3.scene.VertexBuffer.setupData(

at com.jme3.scene.Mesh.setBuffer(

at com.jme3.scene.shape.Torus.setGeometryData(

at com.jme3.scene.shape.Torus.updateGeometry(


Now I figure that creating a new mesh everytime isn’t the way to go, So how I can just update that vertex buffers?

Thank you!

just set it once per frame, not multiple times per frame. And are you doing any multithreading?

1 Like

Most of the JME shapes weren’t setup to be changed after they’ve been rendered. The data has to be updated in place instead of completely reset like most of the shapes do.

…or there is some magic trick that I’ve never learned and so write my own shape meshes.

Sploreg nailed it, I was updating the torus twice in the same frame without realizing it! Thank you!

This was fixed in SVN, so you can call Torus.updateGeometry() many times as well as for the other shapes