Picking Meshes after updateGeometry()

Hi all,



in my scene I have a Box which I can “select” with a MousePick. The Box has for example an extend of 1,1,1. Now I update the Box with

java.updateGeometry(Vector3f.ZERO, 5, 10, 1);

((Box)((Geometry)gizzmo.jmeclass.auswahl).getMesh()).updateBound();

((Geometry)gizzmo.jmeclass.auswahl).updateModelBound();[/java]



But if I want to “select” the Box again, the MousePicking finds the Box only at the old extend, in the middle of the Box with the extend 1,1,1. Does anybody know why?

I guess “mousepicking” is raycasting?

Then

[java]

mesh.createCollisionData();

[/java]

is the Method you are searching for.

If you update the mesh often you will find that it can be quite a strain on the framerate with large meshes, so only call it when you changed the shape of the mesh.

1 Like

Yes, that was it.



Thanks!

1 Like