How can I get a smooth transition between spawn points?
by Jose M Euvin · in Torque Game Engine Advanced · 03/21/2012 (4:45 am) · 8 replies
I start with flymode, looking from the top down and I want to snap into a spawn point in the map. The only thing is that it snaps automatically and I rather have more of a smooth transition.
Any suggestions will be greatly appreciated.
Thank you.
My code looks something like this and it works fine, its just that I don't want a snapping effect, I want a smooth transition.
Any suggestions will be greatly appreciated.
Thank you.
My code looks something like this and it works fine, its just that I don't want a snapping effect, I want a smooth transition.
switch$ (%spawnPointName)
{
case $CameraSpawnPoints::Topdown:
$Camera.JumpToSpawnPoint($CameraSpawnPoints::Topdown)
case $CameraSpawnPoints::Ground:
$Camera.JumpToSpawnPoint($CameraSpawnPoints::Ground)
}
#2
Thank you.
03/21/2012 (6:46 am)
Not sure how to implement that, can you please give me an example.Thank you.
#3
03/21/2012 (8:38 am)
It's just another camera mode. Check the documentation on camera modes (under scripting-> advanced -> camera modes) and also the Torque Script .chm file.
#4
03/21/2012 (10:11 am)
Have you tried using a path (PathedCamera) to move between spawn points instead of jumping to them (Static Camera).
#5
Thank you.
03/21/2012 (3:41 pm)
I'm new to Torque script, I mostly worked with Java in the pass. If you can tell me where to find some examples or where the class library is for this function I'll definitely look into it and try to implement them.Thank you.
#6
Or in the .chm file - search for "camera mode"
04/09/2012 (1:24 pm)
Like Steve said - in the documentation under Scripting->Advanced->Camera Modes....Or in the .chm file - search for "camera mode"
#7
For those who might need it.
Datablock -I added this to
I added these in my Mission file. (This is the path I used.)
Here is my script. (Call it whatever name you want just make sure that you are exec'ing the script.)
Now to test it we just run our game and in the console we type in:
I used CamPath since that's the path I created.
04/10/2012 (3:44 am)
Got it to work. For those who might need it.
Datablock -I added this to
./Core/art/datablocks/camera.cs(Note: This datablock takes a shapefile. Without it, my path camera did not work.)
datablock PathCameraData(CamPath)
{
mode = "";
shapeFile = "core/art/shapes/camera.dts";
};I added these in my Mission file. (This is the path I used.)
new Path(CamPath) {
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";
};
};Here is my script. (Call it whatever name you want just make sure that you are exec'ing the script.)
function CameraGoToPath(%path)
{
// First let's clear out our splines before adding more to it
localclientconnection.camera.reset();
createCameraPath(%path);
localclientconnection.Camera.setPosition(0.0);
}
function createCameraPath(%path)
{
//if the object exits and its not null
if( isObject(%path) && %path.getCount())
{
//go through every marker and add it to the path camera array
for(%i = 0; %i <= %path.getCount(); %i++)
{
%pathNode = %path.getObject(%i);
%transform = %pathNode.getTransform();
%speed = 5000; //5 seconds
%type = "Normal";
%smoothingType = "Linear";
$Camera.pushBack(%transform,%speed,%type,%smoothingType);
}
return $Camera;
}Now to test it we just run our game and in the console we type in:
CameraGoToPath(CamPath);
I used CamPath since that's the path I created.
#8
04/10/2012 (9:00 am)
Excellent work - keep it up!
Associate Steve Acaster
[YorkshireRifles.com]