Problem: Picking on a changing mesh

BlitzMax Forums/MiniB3D Module/Problem: Picking on a changing mesh

Sejster(Posted 2008) [#1]
I stumbled upon the following problem:
I use camera picking on a mesh that is altered ingame (pickmode 2, polygon). While the displayed mesh changes, the mesh that is picked from does'nt seem to: After a change on the mesh, I can still pick the entity on removed parts and not on the added ones. It's like the picking mesh is created internally the first time a Pick command is used and not updated as the mesh changes. The only workaround I found is to create a new mesh everytime a change happens, but that's killing my framerate.
Has anyone else noticed the problem or even has a solution?


simonh(Posted 2008) [#2]
You need to set these values after altering the mesh:

mesh.reset_bounds=True
mesh.col_tree.reset_col_tree=True

Alternatively, use a command like PositionMesh which will do this for you.

It will probably still cause slowdown though, as the collision tree has to be rebuilt.


Sejster(Posted 2008) [#3]
It works - of course it does (you'll have to know), thank you! Great support to a great bunch of code! :)

Does reset_bounds=true update the bounding box of the mesh? So if I just cut holes in my mesh while it's overall size remains the same, I don't have to use it?


simonh(Posted 2008) [#4]
Yes, that's right.