Tight bounding boxes

Hi everyone,

I hope this is in the right place, but sorry if it isn't!

Anyway, I'm attempting to render several cone-shaped objects, which I am doing by importing them as 3DS objects.

I need to put some kind of bounding box around them so that collision detection will work, but I need the box to be tight around the cone.  The problem at the moment is that the box obviously extends away from the model as it is the width of the base of the cone (i.e. a collision is still detected at the thinner part at the top, even when another object hasn't actually touched the cone).

Is there any way to do this?  Or is there another way to use collision detection without bounding boxes?

I hope this makes sense!


So you want a box that doesn't actually look like a box? :slight_smile:

What you want is probably what's known as a "convex hull" of your object. The "bounding" part of jME only supports capsules, boxes and spheres, though, so you can't use that particular part of the engine (it's intended for culling, not for heavy-duty physical simulation).

As long as only one of the two objects that can collide is a mesh, and the others are simpler (sphere, box, etc), then the ODE library works pretty well. However, it doesn't do mesh-mesh in a very robust way. ODE can be used from Java using ODEJava, or using jMonkey Physics which wraps that.

Another option is to build an approximation of your object using existing shapes. For example, a bowling pin might be made up of a sphere at the bottom, and a capsule sticking out the top, with a small box at the very bottom for it to stand still on.

Perhaps there should be a BoundingMesh type of BoundingVolume which would provide more accurate collision detection? Right now doing collision meshes in jME is quite difficult.

We have not had a whole lot of trouble locally… Thoughts on why it is "quite difficult"?

It might not be difficult, but it requires hacking around the engine. It requires custom collision detection code which would be have to be able to access the bounding meshes in the scene graph.

Just a quick sugestion, can use do it in several stages - if there is a collision around the bounding box then check to see if there is a collision within the cone.

It requires custom collision detection code

What's wrong with jmephysics?

The bounding code in jME is for graphics culling. If you want real collision detection, such as for physics, then I suggest using jME Physics 2; that's what it's for!

Hi everyone,

Thanks for your replies!

So it seems as though using jME Physics will solve the problem?  If I use the physicsNodes, will it produce the correct behaviour, as in not using a BB, but using the actual tightly constrained model shape?  Sorry if this is all a bit non-technical, but I'm not too experienced with all of this!  :?

I don't think jME-physics supports bounding meshes either, bounding meshes are sort of a transition between simple bounding volumes to real mesh-based collision detection.

Anyway, for the cone question, you can use triangle-accurate collision to verify that objects indeed collide with the cone, since cones are simple meshes it shouldn't hurt performance too much.

jME Physics 2 does support meshes for intersection.

retrac said:

If I use the physicsNodes, will it produce the correct behaviour, as in not using a BB, but using the actual tightly constrained model shape? 

Yes, you can call generatePhysicsGeometry( true ) to use triangle accuracy.