UV animation

Hi, I try to modify the uvs of a mesh with no real success

Code:
public void update(float tpf) { super.update(tpf); if (init) { setGravity(50); setJumpSpeed(50); setFallSpeed(50); init = false; } else { float du=10*(float) Math.random(); VertexBuffer uvs = creatureGeo.getMesh().getBuffer(Type.TexCoord); for(int i=0;i<uvs.getNumElements();i++) { float u=(Float)uvs.getElementComponent(i, 0); float v=(Float)uvs.getElementComponent(i, 1); uvs.setElementComponent(i, 0, u+du); uvs.setElementComponent(i, 1, v); }


can someone help ?

the uv map should be modified on u axis randomly

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes

@nehon said:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes


sheers

for those interested
Code:
float du=0.1f; if(flip) du=-du; flip=!flip; VertexBuffer uvs = creatureGeo.getMesh().getBuffer(Type.TexCoord); Vector2f[] texCoord= new Vector2f[uvs.getNumElements()]; for(int i=0;i<uvs.getNumElements();i++) { float u=(Float)uvs.getElementComponent(i, 0); float v=(Float)uvs.getElementComponent(i, 1); texCoord[i]= new Vector2f(u+du,v+du); } creatureGeo.getMesh().clearBuffer(Type.TexCoord); creatureGeo.getMesh().setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoord));