Getting multiple objects from the ObjectDB
by Ryan Neighbour · in Torque X 2D · 08/23/2007 (12:06 pm) · 3 replies
Hiya folks,
I'm working on a turret system that auto tracks enemies and I've hit a snag. I can't seem to find a function that returns a set of enemies. I know how to find a single enemy easy enough but I need to get a list of them so I can go through it and find the best target.
Anyone know if there's a built in function for this? Or at least a general method for doing this kind of thing?
Thanks,
Ryan
I'm working on a turret system that auto tracks enemies and I've hit a snag. I can't seem to find a function that returns a set of enemies. I know how to find a single enemy easy enough but I need to get a list of them so I can go through it and find the best target.
Anyone know if there's a built in function for this? Or at least a general method for doing this kind of thing?
Thanks,
Ryan
About the author
Just started an M.Sc. in Electrical and Computer Engineering during which I'll be investigating the use of Agent Based Models in the field of Epidemiology. Aside from that, trying to get my first indie project off the ground and having a blast doing it.
#2
The TorqueDatabase is a Foundation Layer core functionality that in reality provides critical, but very focused functionality: the ability to register objects and search for the objects themselves. It is not related to your "game world" in any way.
The T2DSceneGraph on the other hand is a higher level system (the "Render Layer", which could be more accurately described as the "World Layer") "that provides the concept of "world participation", specifically, locality in this case (although it provides other functionalities as well), which is why you need to query the scene graph, and not the TorqueDatabase itself for a set of objects "nearby" to a location.
08/23/2007 (12:41 pm)
Just a follow-up to Frederic's post (which is accurate in every respect):The TorqueDatabase is a Foundation Layer core functionality that in reality provides critical, but very focused functionality: the ability to register objects and search for the objects themselves. It is not related to your "game world" in any way.
The T2DSceneGraph on the other hand is a higher level system (the "Render Layer", which could be more accurately described as the "World Layer") "that provides the concept of "world participation", specifically, locality in this case (although it provides other functionalities as well), which is why you need to query the scene graph, and not the TorqueDatabase itself for a set of objects "nearby" to a location.
#3
I hadn't thought of looking at the scenegraph, which makes WAY more sense than what I was thinking. Thanks for the help guys.
I'm going to keep the docs in my home pages from now on. It would seem that I keep forgetting they're there.
Thanks again!
08/23/2007 (1:01 pm)
Ah, gotcha.I hadn't thought of looking at the scenegraph, which makes WAY more sense than what I was thinking. Thanks for the help guys.
I'm going to keep the docs in my home pages from now on. It would seem that I keep forgetting they're there.
Thanks again!
Torque Owner Frederic
It uses the T2DSceneGraph.FindObjects() Method which returns a list of all objects matching your query, which allows you to specify a game region, layers and object types to look for.