Game Development Community

T3D 1.1 Beta 2 - pathCamera incorrect rotation - LOGGED

by JerryLiu · in Torque 3D Professional · 08/16/2010 (12:50 pm) · 4 replies

Build: 1.1 Beta 2 debug|Release
Platform: Windows XP SP3 32 bit
Target:
PathCamera
Issues:
PathCamera rotation incorrect

Steps to Repeat:
1.save the scripts as "test.cs" and put it into scripts/server

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

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

datablock PathCameraData(DefaultPathCameraData)
{
};

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

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

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 );

		%p = new PathCamera(%name) {
			dataBlock = DefaultPathCameraData;
			position = %pos;
			rotation = %rot;
		};
		
		for(%i = 1; %i < %path.getCount(); %i++)
		{
			%pathNode = %path.getObject(%i);
			%transform = %pathNode.getTransform();
			%p.pushBack(%transform,2,"Kink","Spline");
		}
		
		return %p;
	}
}

2.luanch 1.1b2 example,under console input "exec scripts/server/test.cs"
3.input "testPathcamera();",the pathcamera named "testCamera" will create
4.the "testCamera" will stop at position 0,input "testcamera.getTransform()",you can see the transform equal intropath's first marker;
5�input testcamera.setTarget(1),the camera will be animation to position 1,when stop,input "testCamera.getTransform()",the console print "87.4005 -126.308 24.794 0.0704525 0.00392769 -0.997507 94.4139",it incorrect,because intropath's second Marker transfrom is "87.4005 -126.308 24.794 0.0704525 0.00392769 -0.997507 7.93102"

console log:
==>exec("scripts/server/test.cs");
1
==>testPathCamera();
==>testcamera.getTransform();
86.902 -139.062 22.794 1 0 0 26.9434
==>testcamera.setTarget(1);
==>testcamera.getTransform();
87.4005 -126.308 24.794 0.0704525 0.00392769 -0.997507 94.4139

#1
08/16/2010 (3:51 pm)
Logged as TQA-822 for the QA Team to verify.
#2
12/17/2011 (2:50 pm)
Has this been verified?
Tried and in my case I get a wrong transform yet at the first marker check...
#3
03/29/2012 (7:04 am)
Where are you declaring this settarget function?
#4
12/28/2014 (9:02 am)
tested with 3.5.1

still unsolved