Ray cast -> no result after updating mesh

Hey yo,



i’ve generated a flat map (Mesh map;) , like its said here https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes?s[]=custom&s[]=mesh.



Then i’m updating the verticles of that mesh and call:

[java]setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));[/java]





Everything works fine, except the ray cast of that mesh doesnt work anymore



http://img269.imageshack.us/img269/3863/datproblem.jpg



somebody know wat is going on?

I think you have to force the collision data to regenerate:

http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Mesh.html#createCollisionData()



Not 100% sure that’s the best way. It’s the only way I saw to do it from a reading of the code, though. (something I highly recommend)

1 Like

map.createCollisionData();

didnt work so i tryed to call

mapgeom.updateModelBound();

after that and it worked.



Its kinda slow but it works. Thanks.