Xierra Posted April 10, 2010 Posted April 10, 2010 Hi guys! I have a question. Do you know most of the NFS games? What I mean here is that when you steer left or right (x) and not up and down, the camera will always follows it. On GTA SA, it doesn't. I already think this is possible in MTA, so I got to figure it out how... I dunno how to start. Can you guys tell me how? XX3 is gone. This is my new name. :3
karlis Posted April 10, 2010 Posted April 10, 2010 (edited) some simple trigonometry, and getting position of vehicle, and zrotation --clientside local enabled=false function getPointFromDistanceRotation(x, y, dist, angle) --credits to robhol local a = math.rad(90 - angle) local dx = math.cos(a) * dist local dy = math.sin(a) * dist return x+dx, y+dy end addCommandHandler("nfscam",function() if enabled then removeEventHandler("onClientRender",getRootElement(),rendercam) else addEventHandler("onClientRender",getRootElement(),rendercam) end enabled=not enabled end) function rendercam() local x,y,z=getElementPosition(getPedOccupiedVehicle(getLocalPlayer())) local _,_,rotz=getElementRotation(getPedOccupiedVehicle(getLocalPlayer())) local x2,y2=getPointFromDistanceRotation(x, y, 15, rotz+180%360) setCameraMatrix(x,y,z,x2,y2,z+6) end Edited April 11, 2010 by Guest [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
Xierra Posted April 11, 2010 Author Posted April 11, 2010 Ah, You put the camera on the cockpit! Also, I don't want camera like that. Something that doesn't shake and doesn't remove the parts of the HUD. XX3 is gone. This is my new name. :3
Xierra Posted April 11, 2010 Author Posted April 11, 2010 No answers? You know, the camera is like in Magnetwheels resource, but what I want is only follows right and left not up and down. XX3 is gone. This is my new name. :3
karlis Posted April 11, 2010 Posted April 11, 2010 hud is not removed, and thats also not cockpit, and add some math.round for camera position for camera shake terminating [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
Dark Dragon Posted April 11, 2010 Posted April 11, 2010 i think this will give a similar effect: -- client addEventHandler("onClientPreRender",getRootElement(), function() setCameraTarget(getLocalPlayer()) end ) Loads of fun for free! Also a lot of fun for free!
karlis Posted April 11, 2010 Posted April 11, 2010 Ye, very nice would be to check mouse and dont set target if mouse moving [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
Xierra Posted April 12, 2010 Author Posted April 12, 2010 Yeah, I want that. Moving the camera by mouse means making the target to be removed, then after 3 seconds of letting it go, target it back again. And dragon, where should I put that? XX3 is gone. This is my new name. :3
Jason_Gregory Posted April 12, 2010 Posted April 12, 2010 In your Clientside Script, onClientRender is a Clientside Function only... Contact me if you need a Website / Signature ↑ / Mapuploadsystem (HTML5, JS, PHP, ASP.NET, MySQL / Sybase)
karlis Posted April 12, 2010 Posted April 12, 2010 try this, heres included that 3sec timer local lastMouseTick=0 local enabled=false function mousemove() lastMouseTick=getTickCount() end function targetcam() if getTickCount()-3000>lastMouseTick then setCameraTarget(getLocalPlayer()) end end function enablecam() if enabled then removeEventHandler("onClientMouseMove",getRootElement(),mosuemove) removeEventHandler("onClientPreRender",getRootElement(),targetcam) else addEventHandler("onClientMouseMove",getRootElement(),mosuemove) addEventHandler("onClientPreRender",getRootElement(),targetcam) end enabled=not enabled end addCommandHandler("nfscam",enablecam) bindKey("N","up","nfscam") note:im not sure do i need use onClientMouseMove or onClientCursorMove [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
Xierra Posted April 12, 2010 Author Posted April 12, 2010 I got bad arguments on line 16 & 19 if I execute a command. What about this, if the vehicle is only facing down, the camera follows it. XX3 is gone. This is my new name. :3
karlis Posted April 12, 2010 Posted April 12, 2010 change mosuemove to mousemove [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now