Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by samgreen
pawn Код:
SetPlayerPos(playerid, SavePos[playerid][picX], SavePos[playerid][picY], SavePos[playerid][picZ]+10); // so the player isn't visible.
// SetPlayerFacingAngle() is unnecessary, this rotates the player in the world. We are dealing strictly with cameras.
SetPlayerCameraPos(playerid, SavePos[playerid][picX], SavePos[playerid][picY], SavePos[playerid][picZ]);
#define DISTANCE 10.0 SetPlayerCameraLookAt(playerid, SavePos[playerid][picX] + DISTANCE * floatsin(-SavePos[playerid][picA], degrees), SavePos[playerid][picY] + DISTANCE * floatcos(-SavePos[playerid][picA], degrees), SavePos[playerid][picZ]);
This code calculates a new point that is DISTANCE away from the Camera's position, it makes use of the Camera facing angle you stored previously, and some laws of triangles. If you would like a more in-depth explanation let me know.
Changing DISTANCE to a larger value will change the Camera Look at location to a point that is farther away from the Camera.
|
Sorry to bump, but I couldn't find a relevant existing up-to-date thread that anyone had replied in.
I can't seem to get this working:
SetPlayerCameraLookAt(playerid, 1474.6978 + DISTANCE * floatsin(90, 90), -1713.1594 + DISTANCE * floatcos(90, 90), 8.2497);
Bit of a newbie question, sorry.