TomPlays Posted June 11, 2015 Posted June 11, 2015 Hello, I am wondering on how I would make an over the shoulder camera view positioning thing for the character. It'd look something like this. http://s139.photobucket.com/user/macmei ... 3.jpg.html Of course I'd script it, but what would be the functions, etc.
Moderators IIYAMA Posted June 11, 2015 Moderators Posted June 11, 2015 Check out this example on wiki: https://wiki.multitheftauto.com/wiki/GetCamera I haven't tried it myself, but it might do what you want(if you edit it ofcourse). Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Dealman Posted June 11, 2015 Posted June 11, 2015 That just gets the camera, you'll want to use setCameraMatrix for something like that. Do note that it'll probably take quite a bit of math to get it the way you want. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Moderators IIYAMA Posted June 11, 2015 Moderators Posted June 11, 2015 Well this will do it, without rendering with setCameraMatrix. But aiming with the gun is kinda impossible. local cam = getCamera() setElementPosition( cam, 0,0,0 ) attachElements( cam, localPlayer, 0.2,-2,0.8, 0,0,0 ) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
TomPlays Posted June 12, 2015 Author Posted June 12, 2015 Well, here's my code. I have no Idea what I'm doing btw, so if someone could help me :DD function setCameraOnPlayerJoin() local cam = getCamera() setElementPosition( cam, 0,0,0 ) attachElements( cam, getLocalPlayer, 0.2,-15,0.8, 0,0,0 ) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) but i get error attempt to call global 'getCamera' (a nil value) on line 2
Dealman Posted June 12, 2015 Posted June 12, 2015 You can not use client-side only functions in a server-side script. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
MTA Team qaisjp Posted June 12, 2015 MTA Team Posted June 12, 2015 setCameraMatrix, getCameraMatrix, onClientMouseMove, getElementPosition, getPedBonePosition
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