SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 17/01/2012, 05:20 PM   #1
park4bmx
High-roller
 
park4bmx's Avatar
 
Join Date: Dec 2009
Location: Samokov,Bulgaria
Posts: 2,361
Reputation: 240
Default mCameraControl (MovePlayerCamera)

mCameraControl 1.1

Info
This is an include that adds more fucntions to the PlayerCamera

Functions
Code:
MovePlayerCamera(playerid,CamX,Camy,CamZ,Float:Speed,CamLookAtX,CamLookAtY,CamLookAtZ)
This will also move the (Camera Facing Position) but you will need to use SetPlayerCameraLookAtEx at your last look At Postion so the camera can be move from the last look at pos to the new one !
if not used the camera will not move !

Code:
MovePlayerCameraEx(playerid,CamX,Camy,CamZ,Float:Speed,CamLookAtX,CamLookAtY,CamLookAtZ)
This will move the camera but will not move the look at position![/u]
It would set its look at position straight away!

Code:
SetPlayerCameraLookAtEx(playerid,X,Y,Z)
This will set the players camera where to look at.
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)
if its "true" that will END ALL Working camera's which means they will freeze if not set to something else!
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)
Checks wether the player camera is moving or not, Example
pawn Code:
if(IsPlayerCameraMoving(playerid)) StopPlayerCamera(playerid);

Code:
OnPlayerCameraMoved(playerid)
This is called when the player's camera finished moving.
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.

2

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.
and thats it this will move the camera to the next 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)

then lets say you want to move the camera to a 2nd car
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.
NOTE the X,Y,Z is your Car 2 Camera Pos 2 and the X2,Y2,Z2 is your Camera Pos 1 of your next car you want to move the camera two
hope it helped

DOWNLOAD[V1.0]
DOWNLOAD[V1.1]
(Not Tested)

DOWNLOAD[V1.0]

Last edited by park4bmx; 26/02/2012 at 11:47 AM.
park4bmx is offline   Reply With Quote
Old 17/01/2012, 05:31 PM   #2
SpiderWalk
Gangsta
 
SpiderWalk's Avatar
 
Join Date: Apr 2010
Location: Serbia
Posts: 970
Reputation: 26
Default Re: mCameraControl (MovePlayerCamera)

NICE!!!!!!!!!!!
SpiderWalk is offline   Reply With Quote
Old 17/01/2012, 05:38 PM   #3
seeeca
Big Clucker
 
Join Date: Jan 2011
Location: Russia
Posts: 59
Reputation: 14
Default Re: mCameraControl (MovePlayerCamera)

Nice, thx
seeeca is offline   Reply With Quote
Old 17/01/2012, 05:40 PM   #4
Psymetrix
Huge Clucker
 
Join Date: Oct 2011
Posts: 292
Reputation: 104
Default Re: mCameraControl (MovePlayerCamera)

Very nice. What's the object used for?
Psymetrix is offline   Reply With Quote
Old 17/01/2012, 05:46 PM   #5
park4bmx
High-roller
 
park4bmx's Avatar
 
Join Date: Dec 2009
Location: Samokov,Bulgaria
Posts: 2,361
Reputation: 240
Default Re: mCameraControl (MovePlayerCamera)

helps the camera move more smoother
park4bmx is offline   Reply With Quote
Old 17/01/2012, 05:53 PM   #6
T0pAz
Guest
 
Posts: n/a
Default Re: mCameraControl (MovePlayerCamera)

Great release! You deserve a reputation!
  Reply With Quote
Old 17/01/2012, 06:23 PM   #7
!LukniS!
Little Clucker
 
Join Date: Dec 2011
Posts: 25
Reputation: 4
Default Re: mCameraControl (MovePlayerCamera)

Thats really nice!
!LukniS! is offline   Reply With Quote
Old 17/01/2012, 07:25 PM   #8
justsomeguy
High-roller
 
justsomeguy's Avatar
 
Join Date: Apr 2010
Location: At rBn's fissa
Posts: 2,474
Reputation: 1976
Default Re: mCameraControl (MovePlayerCamera)

Wow! Thats worth a rep.

PS:
Maybe also a function: SetPlayerCamera(Xfrom player, Yfrom player, Zfrom player);
Would set the camera position, but also mves with the player.
__________________
Mooi verhaal, man.
justsomeguy is offline   Reply With Quote
Old 17/01/2012, 07:31 PM   #9
park4bmx
High-roller
 
park4bmx's Avatar
 
Join Date: Dec 2009
Location: Samokov,Bulgaria
Posts: 2,361
Reputation: 240
Default Re: mCameraControl (MovePlayerCamera)

Quote:
Originally Posted by justsomeguy View Post
Wow! Thats worth a rep.

PS:
Maybe also a function: SetPlayerCamera(Xfrom player, Yfrom player, Zfrom player);
Would set the camera position, but also mves with the player.
yes good idea i will add that later on the next update
park4bmx is offline   Reply With Quote
Old 18/01/2012, 02:37 PM   #10
park4bmx
High-roller
 
park4bmx's Avatar
 
Join Date: Dec 2009
Location: Samokov,Bulgaria
Posts: 2,361
Reputation: 240
Default Re: mCameraControl (MovePlayerCamera)

Quote:
Originally Posted by SpiderWalk View Post
NICE!!!!!!!!!!!
Quote:
Originally Posted by seeeca View Post
Nice, thx
Quote:
Originally Posted by T0pAz View Post
Great release! You deserve a reputation!
Quote:
Originally Posted by !LukniS! View Post
Thats really nice!
Thanks to all if you have any suggestions please say
park4bmx is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 04:46 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.