How do I make a moving camera in a cutscene?
by Oscar Velzi · in Torque 3D Professional · 05/04/2011 (8:17 pm) · 7 replies
I need the camera to follow a certain path in a cutscene, moving from one point to other and facing different directions. How can I do that? I can't find any references in the documentation, and the search function doesn't work well... Can you help me? Thanks!
About the author
Lead Artist of Iron Tower Studio
Recent Threads
#2
05/05/2011 (5:42 am)
And how do I set the player to the cam and tell it to follow the path? Sorry for being so dense, but the online documentation tells nothing about paths and I can't find that script manual CHM file that had many of the commands. It's nowhere I can see in the documentations page...
#3
Use the Force, Luke ... no really, it's the only way to find it.
I've not used PathCamera, but I've set up static camera objects in a scene and moved between them with setControlObject(%camera1) etc
05/05/2011 (6:41 am)
Quote:I can't find that script manual CHM file that had many of the commands. It's nowhere I can see in the documentations page...
Use the Force, Luke ... no really, it's the only way to find it.
I've not used PathCamera, but I've set up static camera objects in a scene and moved between them with setControlObject(%camera1) etc
#4
lol! Yeah, I already found it that way, but only because I searched through Michael Perry's blogs. Any newcomer would expect it to be in the documentations page.
05/05/2011 (6:51 am)
Quote:Use the Force, Luke ... no really, it's the only way to find it.
lol! Yeah, I already found it that way, but only because I searched through Michael Perry's blogs. Any newcomer would expect it to be in the documentations page.
#5
Steve, can you help me a little on how to do what you did? I can't seem to be able to make just a simple path for a camera. I need to make a video with it, it seems it might be easier just to move the camera with my fingers XD
05/05/2011 (8:44 am)
About PathCamera, I have no idea how to use it. I created the datablock, created an pathcamera object, and it doesn't work at all...Steve, can you help me a little on how to do what you did? I can't seem to be able to make just a simple path for a camera. I need to make a video with it, it seems it might be easier just to move the camera with my fingers XD
#6
Making use of setControlObject() you can programatically move the camera/player to any camera/marker/etc in a given scene.
05/05/2011 (9:08 am)
datablock PathCameraData(LoopingCam)
{
mode = "";
};
function LoopingCam::onNode(%this, %camera, %node)
{
if(%camera.path.isLooping)
{
if(%node == %camera.loopNode - 1)
{
%numNodesInPath = %camera.path.getCount();
for(%i = 1; %i < %numNodesInPath; %i ++)
%camera.pushNode(%camera.path.getObject(%i));
%camera.pushNode(%camera.path.getObject(0));
}
else if(%node == %camera.loopNode)
{
%numNodesInPath = %camera.path.getCount();
for(%i = 0; %i < %numNodesInPath; %i ++)
%camera.popFront();
}
}
}
function PathCamera::followPath(%this, %path)
{
%this.path = %path;
if (!(%this.speed = %path.speed))
%this.speed = 100;
%this.pushPath(%path);
%this.popFront();
if(%path.isLooping)
{
%this.loopNode = %path.getCount();
%this.pushNode(%path.getObject(0));
}
}
function PathCamera::pushPath(%this, %path)
{
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 example starts the player as the path camera and uses other code to determine the 'start' position in a scene. It then walks through various scenes...// Create path camera
%this.player = new PathCamera()
{
dataBlock = LoopingCam;
position = Scene::getStartPos();
};
MissionCleanup.add(%this.player);
%this.player.scopeToClient(%this);
%this.setControlObject(%this.player);
SceneGui.setSceneNumber(0); // use other code to choose sceneMaking use of setControlObject() you can programatically move the camera/player to any camera/marker/etc in a given scene.
#7
05/05/2011 (1:55 pm)
I had previously been using setCameraObject and was getting my third person view stuck in the fly camera, with control still with the player. Switching to setControlObject seems to fix this. Still don't know why that is though. Now I just need to figure out how to block on setControlObject, so my GUI doesn't update until the switch happens.
Associate Michael Hall
Big Kid Games