Is this possible? - 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)
+--- Thread: Is this possible? (
/showthread.php?tid=310717)
Is this possible? -
Kasis - 13.01.2012
Is this possible? I can't figure out how if it is... Maybe somebody can help me with this you?
In picture car is driveing. The driver is random player. And I want make a custum camera which will show driving from different angle. Basically look at the picture and instuction below.
A: Player
B: Car
C: Custum camera
D: Point for Custum camera.
Camera C will watch on camera D and both cameras will follow driving vehicle or player.
Re: Is this possible? -
kizla - 13.01.2012
Yes it is..
You just need to use
https://sampwiki.blast.hk/wiki/GetPlayerPos
here is some example..
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerCameraPos(playerid, X, Y, Z + 20);
SetPlayerCameraLookAt(playerid, X + 5, Y, Z);
return 1;
}
Re: Is this possible? -
Kasis - 13.01.2012
Awesome!! Thanks alot kizla.
Re: Is this possible? -
Kasis - 14.01.2012
Hmm... Camera does not follow driving vehicle or player. It doeas not refreshes.
AW: Is this possible? -
Nero_3D - 14.01.2012
Yes, you would need an very fast timer or you use OnPlayerUpdate
pawn Код:
public OnPlayerUpdate(playerid) {
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
new
Float: X,
Float: Y,
Float: Z,
Float: A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
SetPlayerCameraPos(playerid, X, Y, Z + 20);
SetPlayerCameraLookAt(playerid,
X - (floatsin(A, degrees) * 5),
Y + (floatcos(A, degrees) * 5),
Z);
}
return 1;
}