Game Development Community

Maximum points on a path

by David Sill · in Torque Game Engine · 11/04/2004 (9:11 am) · 32 replies

Is there a way to get around the 18 point limit for points on a (camera) path?

The project I am working on is analagous to being in a train on a track. The user will have play, pause, speed up and slow down controls. An option to 'look' using the mouse would be an added bonus. I am currently using PathCamera, but don't have the controls in yet.

Is PathCamera indeed the best way to do this? Is the 18 point limit set in the executable? Is there a way around it in scripting?

I know, lots of questions. Any help is greatly appreciated!
Page«First 1 2 Next»
#21
11/09/2004 (5:24 pm)
No luck here.
Have tried these variations in hopes of getting an echo...

function LoopingCam::onEndOfPath

function PathCameraData::onEndOfPath

function PathCamera::onEndOfPath
#22
11/09/2004 (9:07 pm)
The TGE is using a different counting method than the scripts. These will cure your problem with looping...

function LoopingCam::onNode(%this,%camera,%node)
{
	if(%node == %camera.loopNode)
	{
		%camera.pushPath(%camera.path);
		%camera.loopNode += %camera.path.getCount();
	}
}

function PathCamera::followPath(%cam, %path)
{
	%cam.path = %path;

	if(!(%cam.speed = %path.speed)){%cam.speed = 20;}

	if(%path.isLooping)
	{
		%cam.loopNode = %path.getCount();
	}
	else
	{
		%cam.loopNode = -1;
	}
	
	%cam.setTransform(%path.getObject(0).getTransform());
	
	%cam.pushPath(%path);
}

BTW, if you want to save yourself some time when coding and debugging, use the path's name instead of the path's pathway..

Instead of...

%this.player.followPath("MissionGroup/Paths/Path3", -1);

use

%this.player.followPath(Path3);
#23
11/09/2004 (9:47 pm)
Hmm... I don't believe either David or myself had a problem looping a camera path.

What we're trying to figure out is how to switch to a new path at the end of the old path.

Supposedly this can be done via ::onEndofPath but so far that function never seems to be called.
#24
11/09/2004 (10:12 pm)
Is the Con::execf line that triggers it getting called?
#25
11/10/2004 (12:19 am)
That's because the function doesn't exist in the engine. The only function you are being given to update your status is "onNode"


not sure where you even got the "onEndOfPath" function from, but if you want it to work, then you need to do this instead....

Lets assume you have a Path1, Path2, Path3, etc... And you want the camera to follow them all in succession.....


datablock PathCameraData(LoopingCam)
{
	mode = "";
};


function LoopingCam::onNode(%this,%cam,%node)
{
	if(%node == %cam.loopNode)
	{
		%cam.index++;
		%cam.path = "Path" @ %cam.index;
		
		if(!isObject(%cam.path))
		{
			%cam.index = 1;
			%cam.path = "Path1";
		}
		
		%cam.loopNode += %cam.path.getCount();
		
		%cam.pushPath(%cam.path);
	}
}

function PathCamera::followPath(%cam, %index)
{
	%cam.index = %index;
	%cam.path = "Path" @ %index;

	if(!(%cam.speed = %cam.path.speed)){%cam.speed = 20;}

	if(%cam.path.isLooping)
	{
		%cam.loopNode = %cam.path.getCount();
	}
	else
	{
		%cam.loopNode = -1;
	}
	
	%cam.setTransform(%cam.path.getObject(0).getTransform());
	
	%cam.pushPath(%cam.path);
}


To send the Cam on it's way just use...

%player.camera.followPath(1);
#26
11/10/2004 (7:47 am)
@Ben - sorry don't know how to check that.


@Gonzo -

%cam.path = "Path" @ %cam.index; throws an error as it equates to PathPath1

Changing it to %cam.path = %cam.index; removes the error,
but the camera loops on Path1 or stops at the end depending on the value of isLooping.
#27
11/10/2004 (9:40 am)
From the mission file, the last point in the first loop:
(looping should be "0")

new Marker() {
position = "434.58 -527.783 103.6";
rotation = "1 0 0 0";
scale = "1 1 1";
seqNum = "18";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
speed = "30";
smoothing = "Spline";
jumpToPath = "CameraLoopTwo";
};

and then back to CameraLoopOne at the end of loop two.

many thanks to RobertB
and to everyone else who posted
#28
11/10/2004 (9:49 am)
Slightly offtopic but somewhat relevant, does anyone know how to adjust the 'pull' that (spline smoothed) points have on the path? The analogy would be the length of the handle on a bezier point. It seems to always be either too much or too little. I'm used to Photoshop/Illustrator beziers and the control they give you.

Am I just SOL?

It's difficult to even adjust the angle of the 'pull', alt-rotate only adjusts the view angle. I know you can turn it numerically, but it is a real PITA.

Has anyone worked with these for more than 2 minutes without cursing?
#29
11/10/2004 (12:57 pm)
Quote: %cam.path = "Path" @ %cam.index; throws an error as it equates to PathPath1


I fail to see how Path + 1 = PathPath1. I tested the code myself before I posted it here and it worked perfectly.

The only way that could be is if you used...

%player.camera.followPath(Path1);

Instead of what I said to use which was....

%player.camera.followPath(1);
#30
11/17/2004 (3:41 pm)
@Gonzo
I tried this first: %player.camera.followPath(1);
And it stops at the end of Path1.


@David
I've tried this with various builds and it doesn't seem to work.
jumpToPath = "CameraLoopTwo";


In new SimGroup(Paths) you have this... new Path(CameraLoopTwo) ...?
#31
11/18/2004 (11:02 am)
@Sam

yes, new path(CameraLoopTwo)

in the same simGroup(CameraPaths)

it's probably more reliable to add the second path in the script, rather than the mission editor.



here is pathCamera.cs

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
datablock PathCameraData(LoopingCam)
{
mode = "";
};

function PathCameraData::onNode(%this,%camera,%node)
{
// see if there is a jumpToPath field on this node,
// if there is then lets push that new path to the
// camera.
%camera.currNode++;
%nodeMarker = %camera.path.getObject(%camera.currNode);

if ( %nodeMarker.jumpToPath !$="" )
%camera.pushPath(%nodeMarker.jumpToPath);
}


function PathCamera::followPath(%this,%path)
{
%this.path = %path;
if (!(%this.speed = %path.speed))
%this.speed = 100;

%this.pushPath(%path);
%this.popFront();
}

function PathCamera::pushPath(%this,%path)
{
%this.path = %path;
%this.currNode = 0;
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);
}

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

this works very well.
#32
11/18/2004 (3:17 pm)
David - yep it does work very well, thanks!
Page«First 1 2 Next»