Game Development Community

pathCamera incorrect rotation

by Ahsan Muzaheed · in Torque 3D Professional · 12/28/2014 (9:06 am) · 2 replies

Build: 3.5.1 |Release
Platform: Windows 8
Target:
PathCamera
Issues:
PathCamera rotation incorrect



i tested it with v3.5.1 and found out this bug:
http://www.garagegames.com/community/forums/viewthread/119449/

still unsolved.

anybody have the fix?

About the author

Torque 3D enthusiastic since 2010.Have been working in several T3D projects besides of Unreal Engine 4 and Unity 3D. NEED a hand with your project? SHoot me a mail. http://www.garagegames.com/community/forums /viewthread/138437/


#1
12/28/2014 (6:13 pm)
Pretty sure Camera tracking modes don't update the Camera's rotation for the purpose of getting it from script, which is frustrating. It happens to all camera modes I think. Shouldn't be too difficult a fix, honestly. EDIT: wait, what is the actual problem? I.e. how is the camera transform wrong? Does it never change? Does it change to incorrect values? The post linked just says the number is wrong, but doesn't say how it's wrong.
#2
12/29/2014 (9:29 am)
sorry.whole day gone into office work.

here is my test code:

datablock PathCameraData(DefaultPathCameraData)
{
};

function testPathCamera()
{
	%p = createCameraFollowPath(intropath,testCamera);
	$savecamera = localclientconnection.camera;
	localclientconnection.camera = %p;
	localclientconnection.setControlObject(localclientconnection.camera);
	localclientconnection.camera.setTarget(0);
}




function createCameraFollowPath(%path,%cameraName)
{
	if( isObject(%path) && %path.getCount())
	{
		%pathNode = %path.getObject(0);
		%transform = %pathNode.getTransform();
		%pos = getWords( %transform, 0 ,2 );
		%rot = getWords( %transform, 3 ,6 );
      if(isObject(%cameraName))
          %p=%cameraName;
      else
         %p = new PathCamera(%cameraName) {
            dataBlock = DefaultPathCameraData;
            position = %pos;
            rotation = %rot;
         };
		
		echo(%p.getTransform());
      schedule(100, 0, "printPathCameraTransform",%cameraName);
		for(%i = 1; %i < %path.getCount(); %i++)
		{
			%pathNode = %path.getObject(%i);
			%transform = %pathNode.getTransform();
			%p.pushBack(%transform,2,"Kink","Spline");
			echo(%p.getTransform());
		}
		
		return %p;
	}
}



function printPathCameraTransform(%cameraName)
{
 if(isObject(%cameraName))
 {
   echo(%cameraName.getTransform());
   
     schedule(100, 0, "printPathCameraTransform",%cameraName);
 }
  

}
function cleanTestPathCamera()
{
	localclientconnection.camera.delete();
	localclientconnection.camera = $savecamera;
	localclientconnection.setControlObject(localclientconnection.player);
}


function 
//PathCamera
testCamera::onNode (%this,%node)//A script callback that indicates the path camera has arrived at a specific node in its path. Server side only. 
{
   echo(%this SPC %this.getTransorm() SPC %node SPC %node.getTransorm());
}


my pathnode defination used in default "Outpost.mis":

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

      new Marker() {
         seqNum = "0";
         type = "Normal";
         msToNext = "1000";
         smoothingType = "Spline";
         position = "86.902 -139.062 282.45";
         rotation = "1 0 0 26.9434";
         scale = "1 1 1";
         canSave = "1";
         canSaveDynamicFields = "1";
            Speed = "5";
      };
      new Marker() {
         seqNum = "1";
         type = "Normal";
         msToNext = "1000";
         smoothingType = "Spline";
         position = "87.4005 -126.308 284.45";
         rotation = "0.0704525 0.00392769 -0.997507 7.93102";
         scale = "1 1 1";
         canSave = "1";
         canSaveDynamicFields = "1";
            Speed = "5";
      };
      new Marker() {
         seqNum = "2";
         type = "Normal";
         msToNext = "1000";
         smoothingType = "Spline";
         position = "22.8515 -139.062 282.45";
         rotation = "1 0 0 26.9434";
         scale = "1 1 1";
         canSave = "1";
         canSaveDynamicFields = "1";
            Speed = "5";
      };
   };

as you see,i have used an schedule to print out camera transform.it always prints out same value and that is the transform value of 1st path node(as i re-positioning camera to 1st node on it's spawn )

moreover,there is a engine callback which gets called when path camera arrived at a specific node. but it never was called.that means camera always stuck into it's spawn position.


Quote:
Does it never change?
so i think it actually never changed.


any suggestion?