Game Development Community

Clearing the Pathed Camera Stack of Nodes

by UCF_0017 · in Torque Game Engine · 11/07/2006 (10:28 am) · 5 replies

I was curious.. is there a way to see how many nodes are on the stack for a camera which is taking a motion path?


I have one pathed camera but if I switch to another path before the first path is done, it will finish the first path first and then move slowly over to the newer version.

Therefore, I want to empty the stack of nodes assigned to the camera, but don't know how to access them. :(

Anyone have any suggestion on how? Thanks!


Here is some of the code

//-----------------------------------------------------------------------------
// Path Camera
//-----------------------------------------------------------------------------
datablock PathCameraData(LoopingCam){
   mode = "";
};
function LoopingCam::onNode(%this,%camera,%node){
   if (%node == %camera.loopNode) {
      %camera.pushPath(%camera.path);
      %camera.loopNode += %camera.path.getCount();
   }
}
function PathCamera::followPath(%this,%path){
   %this.path = %path;
   if (!(%this.speed = %path.speed))
      %this.speed = 40;
   if (%path.isLooping)
      %this.loopNode = %path.getCount() - 2;
   else
      %this.loopNode = -1;
   %this.pushPath(%path);
   %this.popFront();
}
function PathCamera::pushPath(%this,%path){
   for (%i = 0; %i < %path.getCount(); %i++)
     %this.pushNode(%path.getObject(%i));
}
function PathCamera::pushNode(%this,%node){
   if (!(%speed = %node.speed))
     %speed = %this.speed;
   if ((%type = %node.type) $= "")
     %type = "Normal";
   if ((%smoothing = %node.smoothing) $= "")
     %smoothing = "Linear";
   %this.pushBack(%node.getTransform(),%speed,%type,%smoothing);
}

#1
11/07/2006 (10:46 am)
I haven't used the pathed camera, but if its path is built like other paths, cant you just query the containing simset (the folder in the editor?)?
#2
11/07/2006 (11:22 pm)
How would I do that in code? When the path camera is midway between one path of lets say 6 nodes, and I want it to immediately start another path of lets say 10 nodes, I'm going to need to clear the remaining 3 nodes of the first path before beginning node 1 of 10 for the second node. That is what I'm trying to figure out how to do.

Thank you for your post. Any help right now would be greatly appreciated.
#3
11/08/2006 (10:24 am)
A quick visit to pathCamera.cc would reveal that it features a reset() method. That should clears all path nodes.
#4
11/08/2006 (4:40 pm)
Thanks so much!
#5
12/02/2006 (6:12 pm)
Is there anyway to do the same thing with AI that are following motion paths?

Like if I tell an AI to follow a motion path when it is in the middle of a prior one, is there some how to clear the paths it was following before following the new motion path?