[Solved] Box collision doesn’t match new Box(Vector3f, Vector3f) constructor

So I’ve got a tree of nodes of Boxes defining a structure. Visually it looks perfect, and all boxes are defined using the Box(Vector3f min, Vector3f max) constructor. I initially assumed this would simply set the size of the box I wanted, but it actually moves the Mesh into place as well. Leaving all of my Boxes at location 0,0,0, gives me the following

I’m attempting to create a separate RigidBodyControl for each of the boxes, as one control for the entire structure seemed to be causing some serious slow-down on collisions. (note, the entire structure is about 20 units across, 5 units high, and 10 units deep), but this is causing the problem you see in the image above. The debug collision hulls are correct in size and orientation, but because the Box is at the origin, the collision hull is also placed at the origin.

I can’t figure out how to get the two to work together. Is there a bug somewhere here where Boxes aren’t supposed to be doing this to geometry? Is there a way to tell Physics to locate itself around the mesh?

Oh and if I do a mesh around the entire tree structure as one RigidBodyControl on the parent node, the hulls and the mesh line up perfectly.

I’m currently using a jME nightly build from July 30th, though I see in the repo that Box nor AbstractBox have been touched since then. I can easily upgrade to a more recent nightly if related behavior has changed.

What do you recommend I do here? Thanks.

Possibly this thread will help: http://hub.jmonkeyengine.org/groups/graphics/forum/topic/how-do-draw-a-bounding-volume/

You are moving the mesh and not the object, do not use the Box constructor to move the boxes… If you use the CollisionShapeFactory a mesh offset will be accounted for, boxcollisionshapes cannot have another center but 0/0/0 though, so if you want to move it, use a CompoundCollisionShape.

you can also move both the collisionShape and box, by setting them both manually, bit more hassle though, or maybe i misread whats happening here.

Played around with CollisionShapeFactory, but no go. It looks like I’ll need to re-do how I’m building these boxes to ensure that the Box itself gets moved and not moving just the Mesh like I have right now.

Thanks for the help.

As a follow up, I changed my geometry generation code to use:

geo = … new Box(x, y, z)


and things are working fine this way.