[Include] mCameraControl (MovePlayerCamera)
#1

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]
Reply
#2

NICE!!!!!!!!!!!
Reply
#3

Nice, thx
Reply
#4

Very nice. What's the object used for?
Reply
#5

helps the camera move more smoother
Reply
#6

Great release! You deserve a reputation!
Reply
#7

Thats really nice!
Reply
#8

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.
Reply
#9

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
Reply
#10

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
Reply
#11

Maybe something to make the camera move very (begin: from slow to fast, end: from fast to slow)
Reply
#12

Pmed you regarding it.
Reply
#13

Haha you released it finally...thanks man
Reply
#14

pastebin please.
Reply
#15

Nice one thks
Reply
#16

very nice job man!
Reply
#17

Man its not working

pawn Code:
if(strcmp("/test",cmdtext,true,10) == 0)
{
    MovePlayerCamera(playerid, 1594.9899, -8765.3593, 59.7103,2.0,1588.3072, -8769.5351, 53.5537);
return 1;
}
its not working can you make an example..please
Reply
#18

Could you release that 'example' script or create one like it for public release?
Reply
#19

Example scritp, please...
Don't get it :S
Reply
#20

Wohoo amazing. I shoud give you rep for this one. Nice work.

Edit: 50ms for time is too much beacause it could cause a lot of lag. Anyways up to you guys, less time best performance more lag. More time less performance less lag.

Edit2: You've put on Timers functions "50" instead "CamereMoveTimer" costant.

So instead of
pawn Code:
SetTimerEx("OnPlayerCameraMove", 50, false ......)
put
pawn Code:
SetTimerEx("OnPlayerCameraMove", CamereMoveTimer, false
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)