Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (AndrewAMD, TipmyPip, NewbieZorro, Grant), 14,196 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How do I control the speed of a rotation camera? #154861
09/17/07 16:23
09/17/07 16:23
Joined: Sep 2007
Posts: 36
Spain
Bahamut Offline OP
Newbie
Bahamut  Offline OP
Newbie

Joined: Sep 2007
Posts: 36
Spain
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;
}
}



Last edited by Bahamut; 09/17/07 16:24.

Working in a RPG
Re: How do I control the speed of a rotation camera? [Re: Bahamut] #154862
09/17/07 16:34
09/17/07 16:34
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
i am no sure but add time_step

partypan -= 1*time_step;


"empty"
Re: How do I control the speed of a rotation camera? [Re: flits] #154863
09/18/07 05:03
09/18/07 05:03
Joined: Sep 2007
Posts: 36
Spain
Bahamut Offline OP
Newbie
Bahamut  Offline OP
Newbie

Joined: Sep 2007
Posts: 36
Spain
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.


Working in a RPG
Re: How do I control the speed of a rotation camer [Re: Bahamut] #154864
09/18/07 11:39
09/18/07 11:39
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
a possible sloppy answer: try increasing or decreasing T
Code:

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



Re: How do I control the speed of a rotation camer [Re: testDummy] #154865
09/18/07 17:32
09/18/07 17:32
Joined: Sep 2007
Posts: 36
Spain
Bahamut Offline OP
Newbie
Bahamut  Offline OP
Newbie

Joined: Sep 2007
Posts: 36
Spain
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...


Working in a RPG
Re: How do I control the speed of a rotation camer [Re: Bahamut] #154866
09/18/07 17:38
09/18/07 17:38
Joined: Sep 2007
Posts: 36
Spain
Bahamut Offline OP
Newbie
Bahamut  Offline OP
Newbie

Joined: Sep 2007
Posts: 36
Spain
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.


Working in a RPG
Re: How do I control the speed of a rotation camer [Re: Bahamut] #154867
09/21/07 10:19
09/21/07 10:19
Joined: Sep 2007
Posts: 36
Spain
Bahamut Offline OP
Newbie
Bahamut  Offline OP
Newbie

Joined: Sep 2007
Posts: 36
Spain
Does anyone understand my code?


Working in a RPG
Re: How do I control the speed of a rotation camera? [Re: Bahamut] #154868
09/21/07 10:37
09/21/07 10:37
Joined: Sep 2007
Posts: 761
Hrvatska (Croatia ), Slavonski...
cro_games Offline
User
cro_games  Offline
User

Joined: Sep 2007
Posts: 761
Hrvatska (Croatia ), Slavonski...
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;
}
}





Hello everyone my name is Ivan Mandic from "Frozen pixel studio". wink
-----------------------------------
Homepage: www.fpx-studio.com
e-mail: emu_hunter_1990@hotmail.com
(working on a game engine)

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1