SA-MP Forums Archive
Need help with camera... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with camera... (/showthread.php?tid=69618)



Need help with camera... - AiVAMAN - 19.03.2009

I have one question: how do I make camera spin around player? i want to make, but nothing is happening to me.. Please help.


Re: Need help with camera... - Nubotron - 19.03.2009

Use trigonometry


Re: Need help with camera... - AiVAMAN - 19.03.2009

Can you explain more detailed please?


Re: Need help with camera... - SpiderPork - 19.03.2009

Here.


Re: Need help with camera... - MenaceX^ - 19.03.2009

Quote:
Originally Posted by ʞɹod ɹǝpıds || SpiderPork
Haha, you made me laugh.


I didn't get your point,
Aiva.


Re: Need help with camera... - SpiderPork - 19.03.2009

It's to encourage people to use ******.


Re: Need help with camera... - Nubotron - 19.03.2009

It is simple, here is a exempel:
pawn Код:
new Float:x, Float:y, Float:z, Float:a;

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (!strcmp(cmdtext, "/lol"))
  {
    GetPlayerFacingAngle(0, a); //the start angle (camera will start spining from the back of the player)
    SetTimer("SpinCam", 10, true); //run the timer to move camera
    return true;
  }
  return false;
}

forward SpinCam();
public SpinCam()
{
  GetPlayerPos(0, x, y, z);
  SetPlayerCameraPos(0, x - 4 * floatsin(-a, degrees), y - 4 * floatcos(-a, degrees), z + 1); //move in perfect circle, at a radius of 4 units from the player.
  //SetPlayerCameraPos(0, x - 4 * floatsin(-a, degrees), y - 7 * floatcos(-a, degrees), z + 1); //move in elipses, nice effect, test it!
  SetPlayerCameraLookAt(0, x, y, z + 0.5);

  if (a >= 360.0)
    a = 0.0;
     
  a += 0.5;
}



Re: Need help with camera... - LarzI - 19.03.2009

Too bad it will continue doing that all the time...


Re: Need help with camera... - Nubotron - 19.03.2009

It is just exemple! Main formula to get spinning camera around point (player pos here).


Re: Need help with camera... - AiVAMAN - 20.03.2009

Quote:
Originally Posted by Nubotron
It is simple, here is a exempel:
pawn Код:
new Float:x, Float:y, Float:z, Float:a;

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (!strcmp(cmdtext, "/lol"))
  {
    GetPlayerFacingAngle(0, a); //the start angle (camera will start spining from the back of the player)
    SetTimer("SpinCam", 10, true); //run the timer to move camera
    return true;
  }
  return false;
}

forward SpinCam();
public SpinCam()
{
  GetPlayerPos(0, x, y, z);
  SetPlayerCameraPos(0, x - 4 * floatsin(-a, degrees), y - 4 * floatcos(-a, degrees), z + 1); //move in perfect circle, at a radius of 4 units from the player.
  //SetPlayerCameraPos(0, x - 4 * floatsin(-a, degrees), y - 7 * floatcos(-a, degrees), z + 1); //move in elipses, nice effect, test it!
  SetPlayerCameraLookAt(0, x, y, z + 0.5);

  if (a >= 360.0)
    a = 0.0;
     
  a += 0.5;
}
thenka, i'll try this.