Game Development Community

Crash on attaching object to path created in script

by DooGoG · in Torque Game Builder · 08/13/2006 (6:53 am) · 2 replies

I'm having trouble attaching an object to a path created in script.

The path is created with:
new t2dPath(tpath) 
{
     scenegraph = $mainScene;
      pathType = "LINEAR";
      pathModeEnum = "WRAP";
      canSaveDynamicFields = "1";
      position = "-3.008 -15.789";
      size = "210.526 168.421";
      node0 = "15.037609 -100.000000 0.000000 10.000000";
      node1 = "-108.270676 48.370930 0.000000 10.000000";
      mountID = "3";
      node2 = "102.255676 68.421051 0.000000 10.000000";
      objectCount = "0";
      nodeCount = "3";
};

All of the values are copied from a path created in the level editor. The only addition is the "scenegraph" field declaration where "$mainScene = sceneWindow2D.getSceneGraph();"

TGB crashes on
tpath.attachObject(tobj, 190);
where tobj is a t2dsprite. How can I fix this? Thanks.

#1
08/13/2006 (7:29 am)
Not sure if you've done this in your code, but the command is 'attachObject':
tPath.attachObject(tObj, 190);
#2
08/13/2006 (5:13 pm)
Yup, sorry that was a typo, I do do attachObject.