Game Development Community

Bounding box intersections

by Gerald Fishel · in Torque Game Engine · 04/29/2004 (9:10 pm) · 1 replies

Hi,

I need to be able to determine if an axis-aligned bounding box intersects any terrain, interior or static objects... dont need any specifics, just a true or false. Is there some efficient mechanism for this available in Torque that I cant find?

I'll probably improvise a workaround to use a series of raycasts for the time being, since it is a one-time operation, just wondering if there is a better way already implemented.

Peace

#1
04/30/2004 (8:10 am)
Here is a little snippet of code that should aim you in the right direction:

// Find all objects of type "contactMask" whose world box overlaps "box"
SimpleQueryList sql;
getContainer()->findObjects(box, contactMask, SimpleQueryList::insertionCallback, U32(&sql));

contactMask would be something like this:

static U32 sContactMask = TerrainObjectType        | InteriorObjectType   |
                            WaterObjectType        | PlayerObjectType     |
                            StaticShapeObjectType  | StaticObjectType;

I'm not on the current HEAD version, but I'm assuming that this stuff hasn't changed.

(edit: forum software does not seem to like apostrophes within the code tag - replaces them with #180)