Lestat Posted July 21, 2015 Share Posted July 21, 2015 Is there a way to get Sniper Zoom % or distance? I tried getCameraMatrix() but it seems the camera position doesn't change, and camera has no getZoom function. Link to comment
Simple0x47 Posted July 21, 2015 Share Posted July 21, 2015 Can you explain better what's the problem? Link to comment
John Smith Posted July 21, 2015 Share Posted July 21, 2015 i believe that sniper zoom effect is made by changing FOV value, but currently you can't get FOV value in mta because its disabled Link to comment
Simple0x47 Posted July 21, 2015 Share Posted July 21, 2015 I know, you can try to make a script that calculate's the distance in meters. And then script the rifle zoom for show you on a part of the screen the distance between the target and you. Link to comment
Lestat Posted July 21, 2015 Author Share Posted July 21, 2015 You can get the fov of the camera with getCameraMatrix, but the fov doesnt change when you zoom with sniper so its not that. the position of the camera, the player and the target (lets say other player) doesnt change when you zoom with sniper. So the camera doesn't move, the fov doesnt change. It has to be a zoom value. But it seems we cant get it Link to comment
Moderators IIYAMA Posted July 21, 2015 Moderators Share Posted July 21, 2015 There might be a way. (probably inaccurate) Using: getScreenFromWorldPosition getWorldFromScreenPosition Since you can convert pixels > units and units > pixels using those functions. When you zoom in, you can see less units than when you zoom out. Etc. Also it might be possible with only getWorldFromScreenPosition, if this returns a correct position. Then you can compare it with getPedTargetStart. Link to comment
Lestat Posted July 22, 2015 Author Share Posted July 22, 2015 Unfortunately that didn't work, but I could do what I wanted to do other way. Not as good but it works Suggestion, we should be able to get the camera zoom when using sniper and camera. Link to comment
1B0Y Posted July 22, 2015 Share Posted July 22, 2015 Suggest it on the bug tracker: https://bugs.mtasa.com/ Link to comment
Moderators IIYAMA Posted July 22, 2015 Moderators Share Posted July 22, 2015 Unfortunately that didn't work, but I could do what I wanted to do other way. Not as good but it works Suggestion, we should be able to get the camera zoom when using sniper and camera. Must have worked 1 of the 2 ways. The only thing you need is creativity and lua skills. There is another thing you can do if you can't get a long with getScreenFromWorldPosition and getWorldFromScreenPosition. By scripting an overwrite. Zooming in mta works with steps, there are an amount of steps you can zoom in/zoom out. bindKey -- "zoom_in" "zoom_out" > function -- create a variable which contains the zoom status. setControlState ( "zoom_in", true) -- zoom in setControlState ( "zoom_in", false) -- increase variable zoom status setControlState ("zoom_out", true) -- zoom out setControlState ("zoom_out", false) -- de-increase variable zoom status toggleControl -- "zoom_in" "zoom_out" > false -- onClientPreRender -- check if aiming with sniper else reset the variable zoom status. I have made it like this before (an overwrite of zooming with sniper), so I can guaranty it will work. Link to comment
Lestat Posted July 22, 2015 Author Share Posted July 22, 2015 I didn't know that, a very good way of doing it. Will try it. Thank you. Link to comment
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