As far as I know you can't do that with the InterpolateCamera functions as they don't have the option to rotate around a spot.
I'd try something under OnPlayerUpdate. Here's what I found on the German SA:MP board.
Код:
#include <a_samp>
enum COORD {
Float:coord_x,
Float:coord_y,
Float:coord_z
}
enum CAMMOVEMENT {
steps,
currentstep,
Float:amount_x,
Float:amount_y,
Float:amount_z,
Float:look_x,
Float:look_y,
Float:look_z,
CameraMoveTimerID
}
forward Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
forward CameraMoveTimer(playerid);
new Float:gPlayerCameraPos[MAX_PLAYERS][COORD];
new Float:gPlayerCamMovement[MAX_PLAYERS][CAMMOVEMENT];
main() {
}
//-------------------------------------------------------------------
public OnGameModeInit() {
AddPlayerClass(0,2040.2158,1355.9232,10.6719,267.2625,0,0,0,0,0,0);
return 1;
}
//-------------------------------------------------------------------
public OnPlayerSpawn(playerid) {
SetPlayerCameraPosEx(playerid, 2052.1799,1384.5262,10.6719,2040.2158,1355.9232,10.6719);
MoveCamera(playerid, 2053.9204,1348.7130,18.6719, 2040.2158,1355.9232,10.6719, 0.2);
return 1;
}
//-------------------------------------------------------------------
stock MoveCamera(playerid, Float:dest_x, Float:dest_y, Float:dest_z, Float:lookat_x, Float:lookat_y, Float:lookat_z, Float:speed) {
new Float:distance;
distance = GetDistanceBetweenPoints(gPlayerCameraPos[playerid][coord_x],
gPlayerCameraPos[playerid][coord_y],
gPlayerCameraPos[playerid][coord_z],
dest_x,
dest_y,
dest_z);
gPlayerCamMovement[playerid][steps] = floatround(distance / speed);
gPlayerCamMovement[playerid][currentstep] = 0;
gPlayerCamMovement[playerid][amount_x] = (dest_x - gPlayerCameraPos[playerid][coord_x]) / gPlayerCamMovement[playerid][steps];
gPlayerCamMovement[playerid][amount_y] = (dest_y - gPlayerCameraPos[playerid][coord_y]) / gPlayerCamMovement[playerid][steps];
gPlayerCamMovement[playerid][amount_z] = (dest_z - gPlayerCameraPos[playerid][coord_z]) / gPlayerCamMovement[playerid][steps];
gPlayerCamMovement[playerid][look_x] = lookat_x;
gPlayerCamMovement[playerid][look_y] = lookat_y;
gPlayerCamMovement[playerid][look_z] = lookat_z;
gPlayerCamMovement[playerid][CameraMoveTimerID] = SetTimerEx("CameraMoveTimer", 50, 1, "i", playerid);
return 1;
}
//-------------------------------------------------------------------
stock SetPlayerCameraPosEx(playerid, Float:cam_x, Float:cam_y, Float:cam_z, Float:lookat_x, Float:lookat_y, Float:lookat_z) {
SetPlayerCameraPos(playerid, cam_x, cam_y, cam_z);
SetPlayerCameraLookAt(playerid, lookat_x, lookat_y, lookat_z);
gPlayerCameraPos[playerid][coord_x] = cam_x;
gPlayerCameraPos[playerid][coord_y] = cam_y;
gPlayerCameraPos[playerid][coord_z] = cam_z;
return 1;
}
//-------------------------------------------------------------------
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2) {
return floatsqroot(floatpower(x1 - x2, 2) + floatpower(y1 - y2, 2) + floatpower(z1 - z2, 2));
}
//-------------------------------------------------------------------
public CameraMoveTimer(playerid) {
if (gPlayerCamMovement[playerid][currentstep] <= gPlayerCamMovement[playerid][steps] - 1) {
gPlayerCameraPos[playerid][coord_x] = gPlayerCameraPos[playerid][coord_x] + gPlayerCamMovement[playerid][amount_x];
gPlayerCameraPos[playerid][coord_y] = gPlayerCameraPos[playerid][coord_y] + gPlayerCamMovement[playerid][amount_y];
gPlayerCameraPos[playerid][coord_z] = gPlayerCameraPos[playerid][coord_z] + gPlayerCamMovement[playerid][amount_z];
SetPlayerCameraPos(playerid, gPlayerCameraPos[playerid][coord_x], gPlayerCameraPos[playerid][coord_y], gPlayerCameraPos[playerid][coord_z]);
SetPlayerCameraLookAt(playerid, gPlayerCamMovement[playerid][look_x], gPlayerCamMovement[playerid][look_y], gPlayerCamMovement[playerid][look_z]);
gPlayerCamMovement[playerid][currentstep]++;
} else {
KillTimer(gPlayerCamMovement[playerid][CameraMoveTimerID]);
}
return 1;
}