InterpolateCameraLookAt

From SA-MP Wiki

Jump to: navigation, search


Description:

Interpolate a player's camera's 'look at' point between two coordinates with a set speed. Can be be used with InterpolateCameraPos.


InterpolateCameraLookAt was added in SA-MP 0.3e This function was added in SA-MP 0.3e and will not work in earlier versions!


Parameters:
(playerid, Float:FromX, Float:FromY, Float:FromZ, Float:ToX, Float:ToY, Float:ToZ, time, cut = CAMERA_CUT)
playeridThe ID of the player the camera should be moved for
Float:FromXThe X position the camera should start to move from
Float:FromYThe Y position the camera should start to move from
Float:FromZThe Z position the camera should start to move from
Float:ToXThe X position the camera should move to
Float:ToYThe Y position the camera should move to
Float:ToZThe Z position the camera should move to
timeTime in milliseconds to complete interpolation
cutThe 'jumpcut' to use. Defaults to CAMERA_CUT (pointless). Set to CAMERA_MOVE for interpolation.


Return Values:

This function does not return any specific values.


Example Usage:

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/rotateme", true))
    {
        TogglePlayerSpectating(playerid, 1);
        InterpolateCameraLookAt(playerid, 50.0, 50.0, 10.0, -50.0, 50.0, 10.0, 10000, CAMERA_MOVE);
        //                                 x1    y1    z1     x2    y2    z2
        // The camera starts off looking at (x1, y1, z1). It will then rotate and after
        // 10000 milliseconds (10 seconds) it will be looking at (x2, y2, z2).
        return 1;
    }
    return 0;
}
Image:32px-Ambox_warning_orange.png

Note

Use TogglePlayerSpectating to make objects stream in for the player while the camera is moving. You can reset the camera behind the player with SetCameraBehindPlayer.


Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
Navigation
Toolbox