FindObjects" method quits working....
by Anthony Ayers · in Torque X 2D · 05/14/2008 (2:31 pm) · 0 replies
Ok, so I have worked my way through the FSM tutorial and the Airplane tutorial and I am trying my own attempt at a hybrid of the two and here is my issue:
From the FSM tutorial, I modified the _GetUnit method like so:
This is working great UNTIL, I decided to use this piece of code from the Airplane tutorial to mount a camera on my player:
Now, whenever I go to select my unit, I dont get anymore results??? If I comment out the PLayerCamera method, I get my results back. I am still VERY newb to all this so hopefully someone can help me out. Much thanks in advance.
From the FSM tutorial, I modified the _GetUnit method like so:
protected List<ISceneContainerObject> _GetUnit(Vector2 location, TorqueObjectType unitType)
{
List<ISceneContainerObject> foundObjects = new List<ISceneContainerObject>();
T2DSceneGraph mySceneGraph = (T2DSceneGraph)TorqueObjectDatabase.Instance.FindObject("DefaultSceneGraph");
mySceneGraph.FindObjects(location, 1.0f, unitType, 0xFFFFFFFF, foundObjects);
if (foundObjects.Count > 0)
{
return foundObjects;
}
else
return null;
}This is working great UNTIL, I decided to use this piece of code from the Airplane tutorial to mount a camera on my player:
protected void PlayerCamera(T2DSceneObject player)
{
//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);
}Now, whenever I go to select my unit, I dont get anymore results??? If I comment out the PLayerCamera method, I get my results back. I am still VERY newb to all this so hopefully someone can help me out. Much thanks in advance.