How to slow speed in Pathing?
by Vlad I · in Torque Game Builder · 10/17/2011 (4:10 am) · 4 replies
How to slow speed in Pathing? It only has constant speed.
I want to be able to slow the speed for my animation to be played properly.
I have a spider animation mounted on Path, it crawls on a table and then at the edge of the table it crawls beneath it.
Also when I play the animation with Follow Mode Restart it goes node by node 0,1,2,3,4 and when it loops back to node 0 the animation doesnt get restarted from frame 0 it is simply plays on from where its last frame was on node 4.
How to reset it to frame 0 when it is back to node 0?
Thanks
I want to be able to slow the speed for my animation to be played properly.
I have a spider animation mounted on Path, it crawls on a table and then at the edge of the table it crawls beneath it.
Also when I play the animation with Follow Mode Restart it goes node by node 0,1,2,3,4 and when it loops back to node 0 the animation doesnt get restarted from frame 0 it is simply plays on from where its last frame was on node 4.
How to reset it to frame 0 when it is back to node 0?
Thanks
About the author
#2
%object.playAnimation(%animationName, false, 0, false);
inside the onPathFinished callback.
function t2dPath::onPathFinished(%this, %object, %node)
{
// %this is the path object.
// %object is the object following the path.
// %node is the end node of the path
}
function t2dPath::onReachNode(%this, %object, %node)
{
// %this is the path object.
// %object is the object following the path.
// %node is the node just reached
}
10/23/2011 (11:37 pm)
There are callbacks for when an object following a path has reached a node or reached the last node. So you could put a line like this,%object.playAnimation(%animationName, false, 0, false);
inside the onPathFinished callback.
function t2dPath::onPathFinished(%this, %object, %node)
{
// %this is the path object.
// %object is the object following the path.
// %node is the end node of the path
}
function t2dPath::onReachNode(%this, %object, %node)
{
// %this is the path object.
// %object is the object following the path.
// %node is the node just reached
}
#3
http://tdn.garagegames.com/wiki/TGB/Reference:_t2dPath
Thanks man!
here is my function for random speed on path if it helps to anyone
function Path01::onReachNode(%this, %object, %node)
{
if(%node $= 3)
{
SpiderPath01.setSpeed(Spider01, getRandom(10, 20));
}
}
10/24/2011 (6:32 am)
Simon you are a legend!!! Damn I didnt notice callbacks at the bottom of the documentaion herehttp://tdn.garagegames.com/wiki/TGB/Reference:_t2dPath
Thanks man!
here is my function for random speed on path if it helps to anyone
function Path01::onReachNode(%this, %object, %node)
{
if(%node $= 3)
{
SpiderPath01.setSpeed(Spider01, getRandom(10, 20));
}
}
#4
Seems like the effect only takes place on restart. Here is the code:
function SpiderFunction::onLevelLoaded(%this, %scenegraph)
{
SpiderPath01.attachObject(Spider01, 10, -1, 1, 2, "wrap", -1, true);
}
function Path01::onReachNode(%this, %object, %node)
{
if(%node $= 5)
{
SpiderPath01.setSpeed(Spider01, 2);
}
}
Any thoughts on that?
10/24/2011 (9:30 am)
Yet I'm still having troubles. When I change the speed, the object (Spider01) automatically appears on start node with new speed while I want it to change the speed on node 5 and continue with new speed.Seems like the effect only takes place on restart. Here is the code:
function SpiderFunction::onLevelLoaded(%this, %scenegraph)
{
SpiderPath01.attachObject(Spider01, 10, -1, 1, 2, "wrap", -1, true);
}
function Path01::onReachNode(%this, %object, %node)
{
if(%node $= 5)
{
SpiderPath01.setSpeed(Spider01, 2);
}
}
Any thoughts on that?
Vlad I
Default Studio Name
Still need help on this. Any suggestion?