Game Development Community

Torque X 4.0 CEV SceneLoader issues

by Ian Wagner · in Torque X 2D · 02/19/2011 (11:45 am) · 2 replies

Hello all,

I'm having a bit of an issue after migrating to the Torque X 4.0 CEV. I have my persistent objects loaded in a scene (called blank.txscene). When I load level1.txscene (my level), then the SceneObjects appear to load (based on stepping through everything in the debugger and lack of crashes). I can also walk around the level and my camera stops properly about where it should at the edge of the level. I also have a system that renders speech bubbles (that are loaded by components attached to scene objects of some NPCs) using GUIText and GUIBitmaps. These continue to render properly so I can see them as I walk around the level. However, nothing else is visible except the player. The player object (which is persistent and loaded by the blank scene) is visible and animates properly when I control him. The whole rest of the level doesn't show up. It's all black, and I can't collide with anything. It's as if all of the scene objects just vaporize or something, but I know that something is there since the SpeechComponents are being loaded. My code is below:

_sceneLoader.Load(@"data\levels\blank.txscene");
_sceneLoader.Load(@"data\levels\level1.txscene");

For what it's worth, I can switch the order and level1.txscene will display, but the player doesn't show up. Anyone have any ideas?

Many thanks in advance!

#1
02/19/2011 (11:52 am)
I am usually revising these methods as well.. but my current method is this.. try it, after you load your scenes.
static public void setToSceneGraph()
        {
            T2DSceneGraph graph = new T2DSceneGraph(); ;
            foreach (T2DSceneCamera _cam in TorqueObjectDatabase.Instance.FindObjects<T2DSceneCamera>())
            {
                T2DSceneCamera temp = _cam;
                if (_cam.SceneGraph.Folder != null)
                {
                    graph = _cam.SceneGraph as T2DSceneGraph;
                    break;
                }
            }
            foreach (ISceneObject2D obj in TorqueObjectDatabase.Instance.FindObjects<ISceneObject2D>())
            {
                obj.SceneGraph = graph;
            }
            foreach (T2DSceneGraph _graph in TorqueObjectDatabase.Instance.FindObjects<T2DSceneGraph>())
            {
                if (_graph != graph)
                    _graph.MarkForDelete = true;
            }
        }
#2
02/19/2011 (2:51 pm)
Thank you soooooo much, Will! That worked perfectly!