Custom Mesh and createCollisionData() problem

How do I change the collision Data of certain a Point (or a Triangle) in a Mesh without recalculating the whole collisionTree(?)?

I have a large static custom Mesh and I want to touch and move only 1 point at a time but recalculating the whole Collision data after every action takes a lot of time and the game start lagging when I do it so I thought it might be faster to only change/recalculate the data of the point that im modifying.

The problem seems to happen in BIHTree but there is no documentation at all in BIHTree and Wikipedia (Bounding interval hierarchy) doesnt help explaning what is going on and now I’m a little bit lost. Can someone help me or point me in the right direction?

You can’t. You can create your own collision handler for your geometry though, sounds like you have a very special setup anyway.

1 Like

As normen says, you can’t… because changing one point may cause the whole tree, or certainly large parts of it, to change. It’s a less extreme example of something like trying to edit a byte in a zipped file… ultimately you have to unzip and rezip it.

Your real solution is going to be not having a “large static custom Mesh” but “several smaller custom meshes”… though note it’s tough to call a mesh ‘static’ when you have desires on changing it. :wink:

@normen said: You can create your own collision handler for your geometry though

Yes thats what I wanted to do, how do I do that? where do start?

Your real solution is going to be not having a "large static custom Mesh" but "several smaller custom meshes"... though note it's tough to call a mesh 'static' when you have desires on changing it. ;)

I tested this and the more objects I put on the scene the more the framerats drops. Its shifting the problem from a momentary “big” problem to many constant small problems. but I guess its still not the best implementation.

The Mesh is “static” in a way that only the y coordinate is modified (x and z are constant), I cant take a terrain implementation because I modify the index buffer on how the mesh is drawn.

@drollian said: Yes thats what I wanted to do, how do I do that? where do start?

Extend Mesh. Override collideWith()… implement your own collision code.

@drollian said: I tested this and the more objects I put on the scene the more the framerats drops. Its shifting the problem from a momentary "big" problem to many constant small problems. but I guess its still not the best implementation.

The Mesh is “static” in a way that only the y coordinate is modified (x and z are constant), I cant take a terrain implementation because I modify the index buffer on how the mesh is drawn.

There is bound to be a trade off between size and number of objects. The other thing that more objects gets you is better culling, also… though you probably aren’t vertex limited anyway. Unknown since we don’t know what “large” is in this case.

Anyway, BVH is not the most efficient way to do collisions with a heightmap anyway so you are better off implementing your own.

1 Like