[Tutorial] Rotacion de Camara
#1

Con esto podemos lograr que la Camara gire cuando estamos seleccionando un Personaje...
Bien comenzemos
_________________________________________________

Colocamos esto por el Inicio del GameMode:
Код:
#define Pos_x 2178.4922 // Coordenada 'X' a donde apunta la Camara
#define Pos_y 1285.8121 // Coordenada 'Y' a donde apunta la Camara
#define Pos_z 42.2499 // Coordenada 'Z' a donde apunta la Camara
#define Pos_angle 90.0764 // Angulo del Jugador

#define camara_x 2961.4202 // X de la Camara
#define camara_y -1875.7118 // Y de la Camara
#define camara_z 9.7813 // Z de la Camara

#define Velocidad 50 // Recomiendo dejarlo asi

enum pInfo
{
	Float:SpawnAngle,
	bool:SpawnRotate,
	SpawnTimer
};
new PlayerInfo[MAX_PLAYERS][pInfo];

forward SetupPlayerForClassSelection(playerid);
forward MoverCamara(playerid);
En OnPlayerRequestClass
Код:
SetupPlayerForClassSelection(playerid);
PlayerPlaySound(playerid, 1097, 0.0,0.0,0.0); // Esto es Opcional
En OnPlayerConnect
Код:
PlayerInfo[playerid][SpawnRotate] = true;
En OnPlayerDisconnect
Код:
KillTimer(PlayerInfo[playerid][SpawnTimer]);
En OnPlayerSpawn
Код:
PlayerInfo[playerid][SpawnAngle] = 0.0;
KillTimer(PlayerInfo[playerid][SpawnTimer]);
PlayerPlaySound(playerid, 1186, 0.0,0.0,0.0); // Esto detiene la Musica Opcional
SetCameraBehindPlayer(playerid);
Al final del GM:
Код:
public SetupPlayerForClassSelection(playerid)
{
		SetPlayerCameraPos(playerid, camara_x,camara_y,camara_z);
		SetPlayerCameraLookAt(playerid, Pos_x,Pos_y,Pos_z);
		
		if (PlayerInfo[playerid][SpawnRotate]) PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoverCamara", Velocidad, true, "i", playerid);
		PlayerInfo[playerid][SpawnRotate] = false;
		return 1;
}

public MoverCamara(playerid)
{
  SetPlayerCameraPos(playerid, Pos_x - 2 * floatsin(-PlayerInfo[playerid][SpawnAngle], degrees), Pos_y - 10 * floatcos(-PlayerInfo[playerid][SpawnAngle], degrees), Pos_z + 3);
  SetPlayerCameraLookAt(playerid, Pos_x, Pos_y, Pos_z + 0.5);
  PlayerInfo[playerid][SpawnAngle] += 0.5;

  if (PlayerInfo[playerid][SpawnAngle] >= 360.0)
    PlayerInfo[playerid][SpawnAngle] = 0.0;
}
Eso es todo.
Aqui les dejo un Video de como me quedo a Mi:
Rotate Camera

Saludos
_________________________________________________

Creditos: WeskeR (Yo)
Codigo base: dice7
Reply


Messages In This Thread
[Tutorial] Rotacion de Camara - by D@nҐ - 19.06.2010, 00:18
Re: [Tutorial] Rotacion de Camara - by Adoniiz - 19.06.2010, 01:13
Re: [Tutorial] Rotacion de Camara - by [TBB]Darkness - 19.06.2010, 01:32
Re: [Tutorial] Rotacion de Camara - by ConecCionMex - 19.06.2010, 01:39
Re: [Tutorial] Rotacion de Camara - by Adoniiz - 19.06.2010, 02:06
Re: [Tutorial] Rotacion de Camara - by D@nҐ - 19.06.2010, 02:20
Re: [Tutorial] Rotacion de Camara - by Karkanos - 19.06.2010, 02:25
Re: [Tutorial] Rotacion de Camara - by MrDeath537 - 19.06.2010, 02:56
Re: [Tutorial] Rotacion de Camara - by D@nҐ - 19.06.2010, 03:07
Re: [Tutorial] Rotacion de Camara - by ConecCionMex - 19.06.2010, 12:37

Forum Jump:


Users browsing this thread: 1 Guest(s)