Bounding box for a simulated situation

Well I am currently stuck and can’t figure out how to solve this problem.

The situation:

I’ve got my avatar model, which is a combination of several model objects glued together by beeing subnodes of an avatar node.

I can control this node like in a third person game, moving it forwards and backwards or let it strafe left and right. I can also rotate the node by moving the mouse left to right. The cam follows the avatar in a fixed angle and I can zoom in and out using the mouse wheel.

Now here’s the problem. In my loop, first the input handlers get called and there I calculate the new local rotation and the new forces applied to the model (I tried to implement a very simple physical simulation with gravity etc.).

After that in simpleUpdate I perform a step in my world simulation where I then really calculate the new translation by calculation speed and movement.

Now what I would need to perform a correct collision detection is some way to calculate a bounding box for this new translation and rotation values without actually applying them to the node, since if I bounce into something I must obviously do a correction to the local translation. Especially the rotation seems to be a problem, since rotating the models obviously makes the bounding box change its size depending on the geometry of the meshes.

Is there any way to calculate the bounding box for the simulated translation/rotation without actually applying the translation/rotation to the whole node and all meshes inside it?

A simple method: You should be able to simply create a new boundingbox, don’t apply it to anything in particular and call computeFromPoints(Vector3f[] points), passing in the translated points where the object would be if moved. Then use that bounding box how you like.

Might not be the most efficient method, but it’s what I could think of this late at night. :slight_smile:

Well, I wanted things to be quite quick, thus saving valuable time for the game logic routines, therefore I didn’t want to do that.

Currently I decided to ignore the problems with the rotation and instead I do a little bit too much collision checking, which is a tradeoff. It may result in little jumps in the positioning because I sometimes detect a collision only on the next frame, but as a benefit I currently have about 300fps, which makes the jumps quite small :slight_smile:

It seems as if creating 3d games always is an attempt to find the reasonable way, not the best way.

The same problem here, when i perform

box.getLocalRotation.fromAxisAngle(FastMath.PI/2, new Vector3f(1, 0, 0));

i have got the box rotated but still nothing happend to bounding box the is attached to it.

could i please have a clue of how to solve this problem. ( Code is appritiated ). :frowning:

Our Bounding boxes are AABB – axis aligned bounding boxes. So they stay aligned to the major axis.

Ok how shall i perform a collision detection if i have the boxes in the game rotaing. (i just can’t have a bonding shpers to the boxes cause i need a correct collision detection, (lets say a thin and tall boxes, imagine what happen if i use bouding shpers )).

So please how its done.

Well, you could do it by helping us implement non-aabb bounding boxes. :wink:

Heh, excuse my being a bit of a smartass, we have that type of bounding on the list of to-do’s. I’m afraid you’ll have to wait for it though. In the meantime, can you make do with the impreciseness of the bounding sphere? You should later be able to swap out for the tighter rotatable bounding boxes.