Camera Not Mounting
by C.Eric Middleton · in Torque Game Builder · 04/14/2010 (8:11 pm) · 2 replies
I have been working on a game that up until now has only had one scene, and everything was fine. When my team and I went to add a splash screen and then transition to the scene we had, the camera broke. It will not mount to anything any more. Here is how I am trying to mount it:
List<ISceneContainerObject> AllObjects = new List<ISceneContainerObject>();
T2DSceneGraph mySceneGraph = (T2DSceneGraph)TorqueObjectDatabase.Instance.FindObject("MyDefaultSceneGraph");
mySceneGraph.FindObjects(new Vector2(0.0f, 0.0f), 10000.0f, TorqueObjectType.AllObjects, (uint)0xFFFFFFFF, AllObjects);
foreach (ISceneContainerObject obj in AllObjects)
{
T2DSceneObject CurrentObject = obj as T2DSceneObject;
if (obj is T2DSceneObject)
{
if (CurrentObject.TestObjectType(TorqueObjectDatabase.Instance.GetObjectType("followBox")))
{
camera.Dismount();
followBox = CurrentObject;
camera.Mount(followBox, "", false);
if (camera.IsMounted)
{
int i = 0;
}
camera.FarDistance = 10000.0f;
}
}
}
The variables are define in the private fields like this:
//Camera Control Variables
static T2DSceneCamera camera = new T2DSceneCamera();
static T2DSceneObject followBox;
static Vector2 followBoxPos = new Vector2(0.0f, 0.0f);
I'm trying to mount the camera to an object in the scene( the followBox) which is just a blank scene object with a velocity. Now, the camera won't mount to the box at all and the if statement never executes (I place a break in there to test the camera mounting);
Does anyone know what the problem is?
List<ISceneContainerObject> AllObjects = new List<ISceneContainerObject>();
T2DSceneGraph mySceneGraph = (T2DSceneGraph)TorqueObjectDatabase.Instance.FindObject("MyDefaultSceneGraph");
mySceneGraph.FindObjects(new Vector2(0.0f, 0.0f), 10000.0f, TorqueObjectType.AllObjects, (uint)0xFFFFFFFF, AllObjects);
foreach (ISceneContainerObject obj in AllObjects)
{
T2DSceneObject CurrentObject = obj as T2DSceneObject;
if (obj is T2DSceneObject)
{
if (CurrentObject.TestObjectType(TorqueObjectDatabase.Instance.GetObjectType("followBox")))
{
camera.Dismount();
followBox = CurrentObject;
camera.Mount(followBox, "", false);
if (camera.IsMounted)
{
int i = 0;
}
camera.FarDistance = 10000.0f;
}
}
}
The variables are define in the private fields like this:
//Camera Control Variables
static T2DSceneCamera camera = new T2DSceneCamera();
static T2DSceneObject followBox;
static Vector2 followBoxPos = new Vector2(0.0f, 0.0f);
I'm trying to mount the camera to an object in the scene( the followBox) which is just a blank scene object with a velocity. Now, the camera won't mount to the box at all and the if statement never executes (I place a break in there to test the camera mounting);
Does anyone know what the problem is?
About the author
Associate William Lee Sims
Machine Code Games