Game Development Community

Name of Scenegraph ?

by Benjamin L. Grauer · in Torque Game Builder · 09/20/2006 (12:58 pm) · 4 replies

It must sound strange to ask such a simple question, but I can get to find out either by searching the forum or the documentation.

How do I know the name of my current scenegraph ?

The fact is, I don't even know how to name it. And, as you can guess, it's really difficult to pause the game without knowing that.

#1
09/20/2006 (1:27 pm)
If you open the level .cs file, you'll see at the top of the file that the first line is creating a new t2dSceneGraph()

just change that to new t2dSceneGraph(MySceneGraph)

and then you can reference it by MySceneGraph without any % or $ in front of it.

Edit:

Option 2: you can check the fish demo and checkersdemo - they use the onLevelLoaded callback to nab the sceneGraph. It's a more generic solution. Note: you have to have something with a "Class" set correctly though or else the onLevelLoaded won't get called.

function FishClass::onLevelLoaded(%this, %scenegraph)
{
   %this.scenegraph = %scenegraph;
   ...
}


-Andrew Douglas
theoreticalgames.com
#2
09/20/2006 (2:52 pm)
Also, sceneWindow2d.getSceneGraph() will get you your current scenegraph unless you renamed the scene window (in which case just use that name instead).
#3
09/20/2006 (3:48 pm)
Works good. Thanks ^^
#4
09/21/2006 (2:51 pm)
You can also set the name, class, and superclass of the scenegraph in the LevelBuilder. Just make sure nothing is selected, and check out the Scene Graph Scripting rollout in the Edit tab.