Game Development Community

How do I get all objects within a defined space?

by ChrisG · in Torque Game Engine · 06/06/2007 (3:37 pm) · 3 replies

How can I find all the objects within a defined space (ie. a cube or a zoned area)?

I thought that I could loop through all objects and test their position (or bounding box) but I was wondering if there is already a function that does something like this?

What want to do is put an elevator into my game. I would prefer to do this using TorqueScript. It doesn't really need a moving platform as once the elevator door closes I could 'teleport' all objects within the elevator to a duplicate elevator on the destination floor.

#1
06/08/2007 (4:34 pm)
Hmm, perhaps InitContainerRadiusSearch could be used? I'm speculating, I'll be following this thread.

I'm guessing that you plan to periodically search the elevator area to see if someone's in there? If that's the case, might be simpler to use a trigger in the elevator.
#2
06/11/2007 (7:11 pm)
@Lee I did a little research over the weekend and came to the same conclusion.
The radius of the search will contain the entire elevator and then some. I'll then do a second search through the found objects just to make sure they are actually within the elevator (a cube).

The trigger will be when the player presses a button to summon the elevator or presses a floor button inside the elevator. Since this is a single player game I don't need to worry about the elevator being used by more than one person at a time.
#3
06/11/2007 (7:15 pm)
Interesting. Thanks for sharing your findings.