[Include] nCamera - Simple Moving Camera Functionality
#1

nCamera - Simple Moving Camera Functionality

pawn Код:
forward OnPlayerCameraFinish(playerid); // Callback, calls when the movement has complete.
forward DestroyCameraForPlayer(playerid); // Destroys the camera before a cycle has finished.
forward UpdatePlayerCameraPosition(playerid); // Include only function, no use to scripter.
forward LastCameraPos(playerid, &Float:x, &Float:y, &Float:z); // Returns the last finished movement cam position.
SetCameraPosForPlayer(playerid, Float:startx, Float:starty, Float:startz, Float:endx, Float:endy, Float:endz, Float:speed, bool:sync_surroundings=false, bool:rand_vw=false); // sync_surroundings means it'll set the player near the camera but out of view so everything surrounding loads in high detail, rand_vw if true puts them in a random virtual world until the cycle is complete otherwise players will see the player floating randomly to the camera position.
Example Usage: OnPlayerConnect()
pawn Код:
SetCameraPosForPlayer(playerid, 1812.8744,-1853.0919,13.4141, 1812.4706,-1857.3477,13.4141, 5.0, true);
pawn Код:
public OnPlayerCameraFinish(playerid) {
    new Float:x, Float:y, Float:z;
    switch(S_CAMERA[playerid]) {
        case 0: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1726.2292,-1857.5374,13.4141, 5.0, true), S_CAMERA[playerid]++;
        }
        case 1: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1726.1542,-1852.1835,13.4141, 5.0, true), S_CAMERA[playerid]++;
        }
        case 2: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1812.8744,-1853.0919,13.4141, 5.0, true), S_CAMERA[playerid]++;
        }
        case 3: {
            LastCameraPos(playerid, x, y, z);
            SetCameraPosForPlayer(playerid, x, y, z, 1812.4706,-1857.3477,13.4141, 5.0, true), S_CAMERA[playerid] = 0;
        }
    }
    return true;
}
The above code cycles all of the points.

Download
Download - Pastebin
Reply
#2

Nice one, Corn!
Reply
#3

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Nice one, Corn!
lol Corn xD

Like always Norn "splendid" work xD keep on doing them :3 who know what useful script you will make
Reply
#4

Cool! FireCat's Real name is james !


10/10 for the script! Good job norm! or corn or whatever it is..
Reply
#5

Quote:
Originally Posted by dadadaamy
Посмотреть сообщение
Cool! FireCat's Real name is james !


10/10 for the script! Good job norm! or corn or whatever it is..
ujelly?
Reply
#6

I search something like that, and i found.
Great script Norn!
Reply
#7

Good
Reply
#8

Good job, I often find lot of people stuck with getting a system similar to work smooth.
Reply
#9

Quote:
Originally Posted by playbox12
Посмотреть сообщение
Good job, I often find lot of people stuck with getting a system similar to work smooth.
I tried a lot to make it work smooth, the smoothest I could find was by creating an invisible player object and setting the camera to follow the object.
Reply
#10

Could you possibly add some way to make a custom angle at the end of endx, endy, endz?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)