Problem creating a rotating camera when selecting skin
#1

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:
Код:
#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;
}
Strangely it does not function as well as i thought. Some clues?
Reply
#2

You can see how such a system would work with this:

https://sampforum.blast.hk/showthread.php?tid=90880
Reply
#3

Thanks man :P I'll check.
P.S. The chase system is completed and released. Look in the Filterscript section
PS.2 Oh man i forgot "degrees" xD
Reply
#4

Quote:
Originally Posted by Phanto90
Посмотреть сообщение
Thanks man :P I'll check.
P.S. The chase system is completed and released. Look in the Filterscript section
I have already played with it. You know what i already think of it m8'y. GREAT STUFF.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)