Game Development Community

Can someone explain this...

by Anthony Ayers · in Torque X 2D · 05/16/2008 (3:37 pm) · 4 replies

Why is it that when I intitialize my game with this code....
//do playerCam            
T2DSceneCamera WorldCam = new T2DSceneCamera();  
WorldCam.CenterPosition = new Vector2(0.0f, 0.0f);            WorldCam.Extent = new Vector2(100.0f, 75.0f);           
 TorqueObjectDatabase.Instance.Register(WorldCam);            
TorqueObjectType playerCam = TorqueObjectDatabase.Instance.GetObjectType("playerCam");            
if (player != null)            
{               
 WorldCam.Mount(player, "select", false);            
}            
// display the camera on screen            
GUIStyle WorldStyle = new GUIStyle();            
GUISceneview WorldView = new GUISceneview();            
WorldView.Style = WorldStyle;            
WorldView.Camera = WorldCam;            
WorldView.RenderMask = playerCam; 
// only render objects of type "playerCam"            
GUICanvas.Instance.SetContentControl(WorldView);

...the FindObjects method stops returning results here????
protected List<ISceneContainerObject> _GetUnit(Vector2 location, TorqueObjectType unitType)        
{            
List<ISceneContainerObject> foundObjects = new List<ISceneContainerObject>();            
T2DSceneGraph mySceneGraph = (T2DSceneGraph)TorqueObjectDatabase.Instance.FindObjects("DefaultSceneGraph");            
mySceneGraph.FindObjects(location, 1.0f, unitType, 0xFFFFFFFF, foundObjects);            
if (foundObjects.Count > 0)            
{                            
return foundObjects;            
}            
else               
 return null;        }

PLease, can someone help me

#1
05/16/2008 (7:33 pm)
Find objects finds objects within a certain radius. I notice your radius is only 1.0. maybe you can increase it? Its sort of hard to tell what you are trying to do.
#2
05/17/2008 (8:25 am)
Actually, this "FindObject" method was working perfectly until I implemented the new camera objects and GUISceneView block of code. So, basically I uncomment the top block of code - the bottom block works fine. Is there some way I need to associate my T2dSceneGraph w/ the new camera/worldview stuff??? Thanks.
#3
05/17/2008 (4:50 pm)
T2DSceneGraph.FindObjects only returns visible objects. Maybe your problem is that setting
WorldView.RenderMask = playerCam;
makes your objects invisible.
#4
05/17/2008 (6:20 pm)
Thanks Robert, I'll give that a shot.