How to script a path? Almost have it, I'm sure...
by Matt Troup · in Torque Game Builder · 09/29/2006 (1:28 am) · 1 replies
I'm looking to script a path instead of hand-make one in the editor.
At this point if you press "Run" nothing happens... (if you echo attributes such as "start node", "speed", etc. they all show up correctly).
However, if you press "Run" again the object will cycle (and if you echo any attributes such as speed, start node, end node, etc... it says there are none!).
After pressing the "run" button the first time if you retype the line "myLinePath.attachObject(ggLogo, 10, -1, 0, 1, "WRAP");" into the console the object to be mounted will MOVE TOWARDS (not instantaneously jump to the node) and then cycle through the path as expected once it reaches the starting node. I tried writing the "myLinePath.attachObject(ggLogo, 10, -1, 0, 1, "WRAP");" line twice-in-a-row within the script file, but it did not work at all.
*puzzled*
Thanks in advance,
-Matt
new t2dPath(myLinePath)
{
scenegraph = mySceneGraph;
pathType = "LINEAR";
canSaveDynamicFields = "1";
position = "0.000 -30.000";
};
myLinePath.addNode("-25.00 -30.00", 0, 10);
myLinePath.addNode("25.00 -30.00", 0, 10);
myLinePath.attachObject(ggLogo, 10, -1, 0, 1, "WRAP");At this point if you press "Run" nothing happens... (if you echo attributes such as "start node", "speed", etc. they all show up correctly).
However, if you press "Run" again the object will cycle (and if you echo any attributes such as speed, start node, end node, etc... it says there are none!).
After pressing the "run" button the first time if you retype the line "myLinePath.attachObject(ggLogo, 10, -1, 0, 1, "WRAP");" into the console the object to be mounted will MOVE TOWARDS (not instantaneously jump to the node) and then cycle through the path as expected once it reaches the starting node. I tried writing the "myLinePath.attachObject(ggLogo, 10, -1, 0, 1, "WRAP");" line twice-in-a-row within the script file, but it did not work at all.
*puzzled*
Thanks in advance,
-Matt
About the author
Torque Owner Matt Troup
Default Studio Name
Edit: I'm using 1.2 that I just downloaded yesterday and it's been acting strange. I transfered old projects and they seem to be having similar problems... only working once, or working only when you run the game twice... objects moving to incorrect layers after the game runs, etc.