Moving Paths or Path Nodes possible?
by Steven Sheffey · in Torque Game Builder · 05/22/2010 (12:23 pm) · 2 replies
Hey all, my goal is to be able to move a path as a whole and move path nodes that have already been set.
I noticed that I can set the position of the overall path, but giving it a linear velocity or using the moveto() function has no effect. In order to move the path, it seems that I would have to call a million schedules of set position to gradually make this path move. Please tell me there is a better way ;)
I noticed that I can set the position of the overall path, but giving it a linear velocity or using the moveto() function has no effect. In order to move the path, it seems that I would have to call a million schedules of set position to gradually make this path move. Please tell me there is a better way ;)
#2
Anyone have an idea of how a path's position could be moved?
05/27/2010 (2:58 am)
Hello, here is my code: (messy but lets you see what Iv'e tried)function pathObj::onLevelLoaded(%this, %scenegraph)
{
%this.schedule(3000, "newPath");
}
function pathObj::newPath(%this)
{
%newPath = new t2dPath() { scenegraph = %this.scenegraph; };
%newPath.addNode("0 0", 0);
%newPath.addNode("-25 0", 1);
%newPath.addNode("-50 0", 2);
%newPath.addNode("-75 0", 3);
//%newPath.moveTo("-15 -20", 10, true, true, true, 0.01);
//%newPath.setPosition(15,20);
%newPath.getImpulseForcePolar( 90, 100, true );
%pathPos = %newPath.getPosition();
echo("Path = " @ %pathPos);
%firstNodeParams = %newPath.getNode(1);
echo("First Node = " @ %firstNodeParams);
%newPath.setPathType("LINEAR");
%newPath.attachObject(%this, 20, 1, 0, 3, "WRAP", 3, false);
echo("NEW PATH CREATED!!");
}Anyone have an idea of how a path's position could be moved?
Torque Owner Steven Sheffey
No Comp Studios