26.06.2017, 14:32
First use TogglePlayerControllable to freeze the player.
Then get the coords and the angle:
Then calculate the position in front of him (replace distance with the distance obviously):
After that set the camera pos to the camx, camy (and z from player position) values and the camera to look at the original Player Position.
Spectate Mode is unneccessary plus it will make it impossible to see your own character.
If you want the character to be a bit more on the right or left of the screen, you can calculate a small offset for the x/y Player Position (similar to how the cam x/y was calculated) to make the camera look at the side of the character.
If you want the cam to be smoothly positioning itself just use CAMERA_MOVE in SetPlayerCameraLookAt.
Then get the coords and the angle:
Код:
new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
Код:
new Float:camx = distance * floatsin(-a, degrees), Float:camy = distance * floatcos(-a, degrees);
Spectate Mode is unneccessary plus it will make it impossible to see your own character.
If you want the character to be a bit more on the right or left of the screen, you can calculate a small offset for the x/y Player Position (similar to how the cam x/y was calculated) to make the camera look at the side of the character.
If you want the cam to be smoothly positioning itself just use CAMERA_MOVE in SetPlayerCameraLookAt.