Game Development Community

Camera on path

by PeterB · in Torque Game Builder · 10/06/2006 (4:51 pm) · 2 replies

I can't get my camera to follow a path. I've tried this code with a staticsprite and it works fine. But with this code, I get no errors and no results. I'm not mounting my camera to anything else by the way. And my global '$thiscamera' works with things like 'setCurrentCameraPosition()'.


%path = new t2dPath()
     {
        scenegraph = t2dscene; 
     };   
     %path.setPosition("0 286");
     
     %path.addNode("0 286");
     %path.addNode("120 286");
     %path.addNode("240 286");
     %path.setDebugOn(BIT(0));
     
     %path.attachObject($thiscamera, 10);

#1
10/07/2006 (12:34 am)
How about instead of a static sprite, you just use a sceneObject (which doesn't render anything). Mount that to your path, and then mount the camera to the object.
#2
10/07/2006 (9:20 am)
And that worked!

%path = new t2dPath()
     {
        scenegraph = t2dscene; 
     };   
     %path.setPosition("0 286");
     
     %path.addNode("0 286");
     %path.addNode("20 286");
     %path.addNode("40 286");
     %path.setDebugOn(BIT(0));
     
     %blank = new t2dSceneObject()
     {
        scenegraph = t2dscene;
     };

     %blank.setPosition("0 286");
     %path.attachObject(%blank, 10); 
     scenewindow2d.mount(%blank, 0, 0, 0);

ty