Game Development Community

Cam Path Not Working

by Jose M Euvin · in Torque Game Engine · 03/29/2012 (9:23 am) · 1 replies

I been testing this for days and I can't get it to work. I even try CamereaPathModel.dump and I do not see a pushback or popback function in it.

I also get errors saying that I cannot call setTarget, for some reason Torque is not treating this object as a PathCamera object.

I'm starting to think that theirs a bug in the system. Torsion Torquescript IDE v1.1.392 Final

Someone Please Help me.

Thank you.

new Path(CameraPathModel) {
   isLooping = "1";
   canSave = "1";
   canSaveDynamicFields = "1";

   new Marker() {
      seqNum = "1";
      type = "Normal";
      msToNext = "1000";
      smoothingType = "Spline";
      position = "-25.0275 -11.5198 1.51868";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      canSave = "1";
      canSaveDynamicFields = "1";
      speed = "5";
   };
   new Marker() {
      seqNum = "2";
      type = "Normal";
      msToNext = "1000";
      smoothingType = "Spline";
      position = "-25.0275 -12.5198 1.51868";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      canSave = "1";
      canSaveDynamicFields = "1";
      speed = "5";
   };
   new Marker() {
      seqNum = "3";
      type = "Normal";
      msToNext = "1000";
      smoothingType = "Spline";
      position = "-25.0275 -13.5198 1.51868";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      canSave = "1";
      canSaveDynamicFields = "1";
      speed = "5";
   };
   new Marker() {
      seqNum = "4";
      type = "Normal";
      msToNext = "1000";
      smoothingType = "Spline";
      position = "-25.0275 -14.5198 1.51868";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      canSave = "1";
      canSaveDynamicFields = "1";
      speed = "5";
   };
};
      

datablock PathCameraData(myPath)
{
   mode = "";
   shapeFile = "art/shapes/vehicles/Car.DAE";
   scale = ".001 .001 .001";
};      
  
//-------------------------------------------------------------------------------------
// in function GameConnection::spawnCamera(%this, %spawnPoint) 
//im setting $Camera = this.camera;
//which is my default camera


function testPathCamera()  
{  
    %p = createCameraFollowPath(CameraPathModel,testCamera);  
    $savecamera = localclientconnection.camera;  
    $Camera = %p;  
    $Camera.setControlObject($Camera);  
    $Camera.setTarget(0);  
}  
  
function createCameraFollowPath(%path,%name)  
{  
    if( isObject(%path) && %path.getCount())  
    {  
        %pathNode = %path.getObject(0);  
        %transform = %pathNode.getTransform();  
        %pos = getWords( %transform, 0 ,2 );  
        %rot = getWords( %transform, 3 ,6 );  
  
//creates a new pathcamera datablock for moving in the game
        %p = new PathCamera(%name) {  
            dataBlock = CamPath;  
            position = %pos;  
            rotation = %rot;  
        };  
          
        for(%i = 1; %i < %path.getCount(); %i++)  
        {  
            %pathNode = %path.getObject(%i);  
            %transform = %pathNode.getTransform();  
            %p.pushBack(%transform,2,"Normal","Spline");  
        }  
          
        return %p;  
    }  
}


I get errors trying to setTarget, because the camerapath datablock does not exist. I am execking my script in client init and it still not working.

I even try creating a pathcamare data block in the console and try using pushback and popback and it did not work. I keep getting uknown function errors.

Please help,

Thank you.