Game Development Community

Bounding Box Problem

by Stephane Conde · in Torque Game Engine · 11/25/2004 (2:14 pm) · 3 replies

I am not sure if this is a bug, but things certainly do not seem to be working correctly. I first noticed this problem in my own heavily modified version of Torque and thought it was my own fault, but I then downloaded a clean HEAD of Torque and saw the problem there as well.

I am basically trying to modify the player's bounding box in only the x or y axis. To do this, I am simply changing the boundingbox variable in the player datablock. Things, however, are not working as I would expect.

If the x and y coordinates of the bounding box are identical, then things work fine, but when one of the values is different than the other, the bounding box often goes right through walls or often collides meters away from a wall. Perhaps this is 'as designed' but it basically prohibits anyone from having a bounding box that is larger in the x than the y or vice versa.

I have taken a few screenshots of this phenomenon...

Here you can see (hopefully) that my bounding box is going through the wall of this building (take note that my player is standing directly next to the building, while the bounding box continues several meters into the building):

torch.cs.dal.ca/~stephane/bounding1.jpg
Here you can see that I have moved my player as close to the side of the building as he can go. His bounding box is no where near the side of the building, but something is stopping him from going closer...

torch.cs.dal.ca/~stephane/bounding2.jpg
It is almost as if the bounding box that is being displayed is not the actual bounding box and the actual bounding box is not being properly oriented when the player rotates around.

I have scoured the forums for anyone experiencing the same problem, but suprisingly cannot find any mention of it... surely I can't be the only one :)

The problem is very easy to duplicate: simply download the latest HEAD of torque, modify the player's boundingbox to something like '1.2 9.2 2.3' and watch as it will go through walls and stop you from moving up against a wall when you clearly should be able to.

Any insight that anyone might have into this issue would be greatly appreciated and thanks in advance for any help!

Stephane

#1
11/26/2004 (11:42 am)
This is just the way the engine works. Since the player is always allowed to rotate freely, the engine assumes the bounding box to be square. Player rotation is not considered at all when calculating the collision. There are two ways to you could change it:
1. Stop the player from rotating when there isnt enough room. This could make movement awkward in tight spaces but it would be easy to implement.
2. Do some physics calculations and push the player off the wall when they rotate into it. This would be much more difficult to implement but it might give a better result.

It just depends on what you want to have happen. When you have a player with a very long bounding box and they scoot sidways up against a wall and then try to turn into the wall, what do you think should happen?
#2
11/26/2004 (9:21 pm)
Hey Eric,

Thank you very much for the reply! But if the engine always assumes that the bounding box is square, then shouldn't it collide with the building in screenshot number one above? Perhaps I missed something in your explanation...

Thanks again!

Stephane
#3
11/29/2004 (10:07 am)
I'm too lazy to check, but it probably just uses the x value