• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] How can I position the camera in front of the vehicle?
#2
PHP Code:
stock Float:GetPosInFrontOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance) { ? ? new Float:a; ? ? GetVehiclePos(vehicleid, x, y, a); ? ? GetVehicleZAngle(vehicleid, a); ? ? x = (distance * floatsin(-a, degrees)); ? ? y = (distance * floatcos(-a, degrees)); ? ? return a; }

PHP Code:
new Float:Pos[3]; GetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]); SetPlayerCameraLookAt(playerid,Pos[0], Pos[1], Pos[2]); GetPosInFrontOfVehicle(GetPlayerVehicleID(playerid), Pos[0], Pos[1], 7.0);//If you want the camera to stay behind the vehicle, just put a negative value, for example: -7.0 SetPlayerCameraPos(playerid, Pos[0], Pos[1], Pos[2].0);//Here you adjust the height of the camera, example: .0
  Reply


Messages In This Thread
RE: How can I position the camera in front of the vehicle? - by JR_Junior - 2021-07-30, 04:41 AM