19.03.2011, 16:32
Hello all!
Some days ago, i've got the idea to create a "rotating camera" when player entered the skin selection menu, but actually i'm having some problems. I thought trigonometric functions as floatsin & floatcos woul been useful
This is what i've done:
Strangely it does not function as well as i thought. Some clues?
Some days ago, i've got the idea to create a "rotating camera" when player entered the skin selection menu, but actually i'm having some problems. I thought trigonometric functions as floatsin & floatcos woul been useful
This is what i've done:
Код:
#include <a_samp>
//==============DA MODIFICARE SECONDO LE VOSTRE ESIGENZE
#define XP -2284.2703 //XPosPlayer
#define YP 2367.9077 //YPosPlayer
#define ZP 5.4795 //ZPosPlayer
#define ALTEZZA_TELECAMERA 0.5 //ADD HEIGHT TO THE CAMERA
#define MOLTIPLICATORE_DISTANZA 1.2 //DISTANCE MULTIPLIER FOR THE ROTATING CAMERA
new Angolo[MAX_PLAYERS],Timer[MAX_PLAYERS]; //VARIABLES THAT CONTROL THE DEGREES(Angolo) AND TIMERS FOR PLAYERS
//============================================================ONFILTERSCRIPTINIT
public OnFilterScriptInit()
{
print("\n________________________________________");
print(" PRotatingCamera by Phanto90 Loaded");
print("________________________________________\n");
return 1;
}
//==========================================================ONPLAYERREQUESTCLASS
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,XP,YP,ZP);
SetPlayerCameraPos(playerid,XP+floatcos(Angolo[playerid])*MOLTIPLICATORE_DISTANZA,YP+floatsin(Angolo[playerid])*MOLTIPLICATORE_DISTANZA,ZP+ALTEZZA_TELECAMERA);
Timer[playerid]=SetTimerEx("Rotazione",1000,true,"idx",playerid);
return 1;
}
//=====================================================================ROTAZIONE
forward Rotazione(playerid);
public Rotazione(playerid)
{
Angolo[playerid]++;
if(Angolo[playerid]==360) Angolo[playerid]=0;
SetPlayerCameraPos(playerid,XP+floatcos(Angolo[playerid])*MOLTIPLICATORE_DISTANZA,YP+floatsin(Angolo[playerid])*MOLTIPLICATORE_DISTANZA,ZP+ALTEZZA_TELECAMERA);
return 1;
}
//=================================================================ONPLAYERSPAWN
public OnPlayerSpawn(playerid)
{
TogglePlayerControllable(playerid,0);
SetPlayerPos(playerid,XP,YP,ZP);
SetPlayerCameraPos(playerid,XP+floatcos(Angolo[playerid])*MOLTIPLICATORE_DISTANZA,YP+floatsin(Angolo[playerid])*MOLTIPLICATORE_DISTANZA,ZP+ALTEZZA_TELECAMERA);
KillTimer(Timer[playerid]);
return 1;
}



