How do I control the speed of a rotation camera?

Posted By: Bahamut

How do I control the speed of a rotation camera? - 09/17/07 16:23

I have a function that rotates the camera 360 degrees arround my character, but i want to control de rotation speed and i cannot understand very well how to include and speed variable or how to modify it, this script is from long time ago but it works very well.

Can someone help me how can i slow the rotation speed?
Thx!

Code:
 function r360
{
var radio = 500; //circle
var SC = 1.0; //When increased, circle becomes elliptic
var cx = 0; //Coordenada X - Centro del circulo (la camara rota en torno al centro)
var cy = 0; //Coordenada Y - Centro del circulo (la camara rota en torno al centro)
var T = 0; //Rotation width
var xx;
var yy;
var partypan = 180;

while(state==field1)
{
while (T < 360)
{
T += 1;
partypan -= 1;
xx = (SC * (cos(T) * radio)) + cx;
yy = cy - (sin(T) * radio);
cam_lejana.x = xx;
cam_lejana.y = yy;
if(partypan==0) {partypan=360;}
cam_lejana.pan = partypan;
wait(1);
}
T = 0;
partypan = 180;
}
}


Posted By: flits

Re: How do I control the speed of a rotation camera? - 09/17/07 16:34

i am no sure but add time_step

partypan -= 1*time_step;
Posted By: Bahamut

Re: How do I control the speed of a rotation camera? - 09/18/07 05:03

Quote:

i am no sure but add time_step

partypan -= 1*time_step;




It's not working.
This way the camera rotates without moving arround the player.
Posted By: testDummy

Re: How do I control the speed of a rotation camer - 09/18/07 11:39

a possible sloppy answer: try increasing or decreasing T
Code:

//increase or decrease 6.66
T += 6.66 * time_step;
//T %= 360;


Posted By: Bahamut

Re: How do I control the speed of a rotation camer - 09/18/07 17:32

Quote:

a possible sloppy answer: try increasing or decreasing T
Code:

//increase or decrease 6.66
T += 6.66 * time_step;
//T %= 360;






I don't get it, where do i put that?
Why did you comment this "T %= 360;"?

I tried just modifying the T += 1;
to T += 6.66 * time_step; and modifying the 6.66 is not working.

I dont understand what are you trying to say me...
Posted By: Bahamut

Re: How do I control the speed of a rotation camer - 09/18/07 17:38

I tried changing the wait(1) to wait(2) and it works, but it doesn't looks smooth, its like the game had low framerates.
Posted By: Bahamut

Re: How do I control the speed of a rotation camer - 09/21/07 10:19

Does anyone understand my code?
Posted By: cro_games

Re: How do I control the speed of a rotation camera? - 09/21/07 10:37

Try this:

Code:

function r360
{
var radio = 500; //circle
var SC = 1.0; //When increased, circle becomes elliptic
var cx = 0; //Coordenada X - Centro del circulo (la camara rota en torno al centro)
var cy = 0; //Coordenada Y - Centro del circulo (la camara rota en torno al centro)
var T = 0; //Rotation width
var xx;
var yy;
var partypan = 180;

while(state==field1)
{
while (T < 360)
{
T += 0.1;
partypan -= 0.1;
xx = (SC * (cos(T) * radio)) + cx;
yy = cy - (sin(T) * radio);
cam_lejana.x = xx;
cam_lejana.y = yy;
if(partypan<=0) {partypan+=360;}
cam_lejana.pan = partypan;
wait(1);
}
T = 0;
partypan = 180;
}
}



© 2024 lite-C Forums