|Category||Farming Simulator 2009|
|Mark Farrington (chorleyboy)||29.03.2010 14:18|
I've written a mod that connects to a map object (the locations of which are given in relative terms from the main map root .e.g. 24|4|0). All I need now is to work out which node (at the root of the scene graph is the main root node for the current map). The problem I have is that the map root node name doesn't match the name given as the argument to the loadMap script function. For example:
self.mapRootNode = nil;
for i=0,getNumOfChildren(getRootNode()) do
local node = getChildAt(getRootNode(), i);
if getName(node) == name then
self.mapRootNode = node;
After the above code self.mapRootNode is still nil. The map I'm loading is the default map that comes with the game (map01). The result of the print statements is shown below, notice that in the scene graph the root is actually called map02 and is at position 4.
map map01 was loaded
0 default camera
Obviously the index of the map changes if the user quits back to the menu and then reloads so I can't just hard-code in to use position 4 either.
Is there a better way to connect to the map root or is it safe to assume that the map root node is always called map02?
|Stefan Geiger - GIANTS Software||01.04.2010 09:20|
|The root node is stored in g_currentMission.rootNode.
Assuming the name to be map02 is not a good idea, if you want to support mod maps as well. This name is stored in the map i3d and can be defined by the creator of the map.
Note: Log in to post. Create a new account here.