17.01.2012, 17:20
(
Last edited by park4bmx; 26/02/2012 at 11:47 AM.
)
mCameraControl 1.1
InfoThis is an include that adds more fucntions to the PlayerCamera
Functions
Code:
MovePlayerCamera(playerid,CamX,Camy,CamZ,Float:Speed,CamLookAtX,CamLookAtY,CamLookAtZ)
if not used the camera will not move !
Code:
MovePlayerCameraEx(playerid,CamX,Camy,CamZ,Float:Speed,CamLookAtX,CamLookAtY,CamLookAtZ)
It would set its look at position straight away!
Code:
SetPlayerCameraLookAtEx(playerid,X,Y,Z)
NOTE: if your going to use it do NOT do it as #define on the top! you will have to change them manualy !
you can do it quick by CTRL + H
[code]StopPlayerCamera(playerid)[/bcode
Stops the player camera.
Code:
StopRunningCameras(True/False)
but if its "false" it will only return the number of cameras running!
NOTE: in V1.1 the valiu has being change to a bool only !
Functions In V1.1
Code:
IsPlayerCameraMoving(playerid)
pawn Code:
if(IsPlayerCameraMoving(playerid)) StopPlayerCamera(playerid);
Code:
OnPlayerCameraMoved(playerid)
NOTE's:
You will need to add it to your script when compiling to prevent errors!
This is not called when using StopPlayerCamera,StopRunningCameras
Also done some visual changes to the look at poz when moving the camera.
the CameraMoveTimer is fixed in the config line 17
And some minor bug fixes.
Video Preview (example what it could be used for)
[ame]http://www.youtube.com/watch?v=NeLXB7cWn8E[/ame]
How To Use
if you want to create a moving camera from lets say your just playing around and you want ot move tha camera to what ever X,Y,Z and you set it to Look At Pos the distance could not be worked out between you current looking at pos. to your new one! that is becouse the script does now know where you current camera position is.
so thats why i made SetPlayerCameraLookAtEx so you can tell the script your last look at position so it can calculate the distace from the old pos to the new.
but you can skip the Looking at Movement by using MovePlayerCameraEx which will directly change the look at pos but still move to the new position! i will add a function that will get your looking at pos later on.
Moving the camera
[1]
ok lets say you just want to make a camera like in the video is simple
all you need is 3 camera positions (or how many views you want) and 3 look at positions.
then you set the first one like this,
pawn Code:
SetPlayerCameraPos(playerid,X,Y,Z);//Where the camera's first position will be.
SetPlayerCameraLookAtEx(playerid,X,Y,Z);//the cameras look at pos. remember to put [EX] so the script knows your last look at pos.
Then lets say when you type a CMD or press a button you want to change the view 2 this is what you do.
pawn Code:
MovePlayerCamera(playerid,newX,newY,newZ,The_Speed,NewLookAt_X,Y,Z);//this is withought [Ex] becouse we have set the last CameraToLook at position.
Moving the camera(example 2)
ok many people didnt get it :/
so if creating a camera like in the video you will need to get couple of positions first like shown in the diagram
ok so Camera Pos 1 is the Look At Position you will need to get for your view.
then the next camera position is where your camera will be palced which is Camera Pos 2
that is NOT inside the car its outsdie the car where you want the camera to be placed so it will look at Camera Pos 1
and after you have those two positions all you need to do is
pawn Code:
SetPlayerCameraLookAtEx(playerid,X,Y,Z);//This is the cors you got form Cam Pos 1 (where the camera will be looking at!)
SetPlayerCameraPos(playerid,X,Y,Z);//your Camera Pos 2 cords (where the camera will be placed)
you again get the Cam Pos 1 and Cam pos 2 positions of your second car and make it move like this
pawn Code:
MovePlayerCamera(playerid,X,Y,Z,The_Speed,X2,Y2,Z2);//this is withought [Ex] becouse we have set the last CameraToLookAtEx position.
hope it helped
DOWNLOAD[V1.0]
DOWNLOAD[V1.1]
(Not Tested)
DOWNLOAD[V1.0]