Checking obstacles
by Luis Anton · in Torque Game Engine · 01/11/2004 (1:04 pm) · 9 replies
In order to let my bots walk arround without colliding with every object in the scene, I want to look for obstacles around them. Currently, I'm using the InitContainerRadiusSearch and the containerSearchNext() functions to find objects around a certain position (well, each bot's position), so I can 'easily' calculate an 'evasive' vector. It works pretty well, but I discovered that those functions work with the objects' bounding boxes. That's logicall, it's much faster than analysing each polygon around a point... but the problem is that I have lots of unreliable bounding boxes, wich are too big or do not share rotation with the object they belong to. That's the result of an unhappy model design decision (however, it allows us to position the objects in Torque sharing the same orientation they had in 3DStudio in a fast way), which would be really hard to solve now...
Well, the thing is that I must look for geometry, instead of bounding boxes. Or for a miracle, instead of geometry, so our bots could be aware of what lies around them...
ContainerBoxEmpty(...) works with geometry, doesn't it? But does it allow you to analyze every object inside the container box, like in a containerRadiusSearch? I need to do it in order to calculate the 'evasive' vector and avoid the obstacles.
I may even be following a totally wrong approach to solve the bot navigation problem...
Well, the thing is that I must look for geometry, instead of bounding boxes. Or for a miracle, instead of geometry, so our bots could be aware of what lies around them...
ContainerBoxEmpty(...) works with geometry, doesn't it? But does it allow you to analyze every object inside the container box, like in a containerRadiusSearch? I need to do it in order to calculate the 'evasive' vector and avoid the obstacles.
I may even be following a totally wrong approach to solve the bot navigation problem...
#2
You might also try tweaking Torque's notion of a bounding box so all the container stuff works out "right".
01/11/2004 (3:12 pm)
You might try using raycasts and collision meshes...You might also try tweaking Torque's notion of a bounding box so all the container stuff works out "right".
#3
Ben, I've tried raycasts for detecting buildings, but I don't know what you mean with collision meshes... I know what they are, but not how to use them for my purpouses.
01/11/2004 (11:38 pm)
No, I have not messed with BB parameters, Martin. It's just the way the modellers defined them in 3DStudio. Anyway, the problems is not about bots, their BB is ok :)Ben, I've tried raycasts for detecting buildings, but I don't know what you mean with collision meshes... I know what they are, but not how to use them for my purpouses.
#4
Another heuristic you might try is doing a raycast check in each of the 4 or 8 cardinal directions.
-s
01/12/2004 (9:45 am)
I was going to attempt the same thing for collision detection/pathing for my AI. So is the only problem that your bounding boxes are too big/not aligned properly? Another heuristic you might try is doing a raycast check in each of the 4 or 8 cardinal directions.
-s
#5
Failing that, maybe you should add an additional, "real" bounding box that you can use for container searches.
Are we talking about interiors or 3space shapes?
01/12/2004 (11:00 am)
Really, you should have your artists set up the right bounding boxes. Maybe you can tweak the exporter to note the "origin" of the shapes so that the bounding box can stay correct?Failing that, maybe you should add an additional, "real" bounding box that you can use for container searches.
Are we talking about interiors or 3space shapes?
#6
Well, I think I'll use a combination of InitRadiusSearch (two meters around a bot) and the raycast check (eyeVector direction, to let the bot know if there's something in front of it). If I had enough time I would calculate a new bounding box after placing the buildings (.dts), but unfortunately there's no time for extra programming in our proyect :(
It was all .dts, Ben. Which reminds me of another problem... I'll begin a new thread, because it's about transparency.
01/12/2004 (11:58 pm)
Yes, I know they should be set up properly :( Well, I think I'll use a combination of InitRadiusSearch (two meters around a bot) and the raycast check (eyeVector direction, to let the bot know if there's something in front of it). If I had enough time I would calculate a new bounding box after placing the buildings (.dts), but unfortunately there's no time for extra programming in our proyect :(
It was all .dts, Ben. Which reminds me of another problem... I'll begin a new thread, because it's about transparency.
#7
I know that, for the player, the engine calculates its bounding box, so it must be possible to do it for any .dts shape. Where should I start from? :m I'll search through the code, but I'm not really sure what I'm looking for...
01/14/2004 (3:15 am)
Um, Ben, I think I need that additional 'real' bounding box, but I need it to replace the one from 3DStudio. I won't ask if it's possible, because I must be, but I may need some clues. I know that, for the player, the engine calculates its bounding box, so it must be possible to do it for any .dts shape. Where should I start from? :m I'll search through the code, but I'm not really sure what I'm looking for...
#8
01/14/2004 (11:12 am)
I thought the engine loaded the bounding box from the model data...
#9
Anyway, it would be interesting to calculate the 'perfect' bounding box, wouldn't it? :m I remember reading in a post that hardcoring the bounding box in the engine would create some problems, but I can't imagine them :? There are algorithms for calculating the minimux convex polygon envolving a shape, they could be useful for that 'perfect bounding box'...
01/14/2004 (1:47 pm)
It does, that's why I wanted to -replace- it, because the bounding box loaded from the model data wasn't properly created in 3DStudio (it's rotated) :) Well, finally, due to a serious shortage of available time, we have decided to replace certain transparent shapes with complex geometry...Anyway, it would be interesting to calculate the 'perfect' bounding box, wouldn't it? :m I remember reading in a post that hardcoring the bounding box in the engine would create some problems, but I can't imagine them :? There are algorithms for calculating the minimux convex polygon envolving a shape, they could be useful for that 'perfect bounding box'...
Torque 3D Owner Martin "Founder" Hoover