SceneGraph.FindObjects returns too many objects
by Frederic · in Torque X 2D · 08/19/2007 (2:59 pm) · 0 replies
The SceneGraph.FindObjects method seems to return all objects with
obj.xmin < query.xmax &&
obj.xmax > query.xmin &&
obj.ymin < query.ymax &&
obj.ymax > query.ymin.
(I do not have the source code, so I might be wrong This is just what I'm guessing after some hours of debugging my mouse pointer functions.)
This means that a diagonal line from the top left corner to the bottom right corner of the screen will be returned in all queries that contain query coordinates inside the screen.
This might be an extremely efficient implementation. But the problem is when using rotated objects, especially with large differences between height and width, these obects will be contained in many queries they should not be in.
If this is a design decision, it would be great, if not very important, to mention it in the API doc.
Looking at SceneContainer Protected Methods in the API doc, there is already a _FindObjectsInefficiently mentioning something about verifying FindObjects. But this method does not provide any means of spatial queries (although mentioned in the API doc), and it is protected, thus not easily accessible.
obj.xmin < query.xmax &&
obj.xmax > query.xmin &&
obj.ymin < query.ymax &&
obj.ymax > query.ymin.
(I do not have the source code, so I might be wrong This is just what I'm guessing after some hours of debugging my mouse pointer functions.)
This means that a diagonal line from the top left corner to the bottom right corner of the screen will be returned in all queries that contain query coordinates inside the screen.
This might be an extremely efficient implementation. But the problem is when using rotated objects, especially with large differences between height and width, these obects will be contained in many queries they should not be in.
If this is a design decision, it would be great, if not very important, to mention it in the API doc.
Looking at SceneContainer Protected Methods in the API doc, there is already a _FindObjectsInefficiently mentioning something about verifying FindObjects. But this method does not provide any means of spatial queries (although mentioned in the API doc), and it is protected, thus not easily accessible.