updateModelBound vs updateWorldBound

Hello!
In our project Geometry is updated interactively: user can drag control points, mesh is regenerated automatically.

On next update() Geometry.updateModelBound() is called. Bounding box is calculated correctly and Geometry is visible.

But we have an issue with collision detection: world Bounding box is not updated, so collision doesn’t detected!

Geometry.updateWorldBound() is called by engine. Geometry in its turn calls Spatial.updateWorldBound(), which resets refreshFlags before actual update of world bounding box.

[java]
protected void updateWorldBound() {
// the world bound of a leaf is the same as it’s model bound
// for a node, the world bound is a combination of all it’s children
// bounds
// -> handled by subclass
refreshFlags &= ~RF_BOUND;
}
[/java]

Geometry.collideWith() calls checkDoBoundUpdate().

[java]
void checkDoBoundUpdate() {
if ((refreshFlags & RF_BOUND) == 0) {
return;
}
[/java]

You have to update the bounds of the mesh first. And if you want accurate collision data you also need to clear that on the mesh, too.

Thank you for the reply.

But Geometry.updateModelBound() does call Mesh.updateBound().

I have added createCollisionData() into my custom Mesh and it works!

Thanks again!