Jump to content

How do I "lock" the zoom at a certain point


Onkeen

Recommended Posts

Hi guys,

 

I'm curently working on a vision diseaes related mod and I would love to be able to add it some overhauls by controling the zoom (lock it, change it etc...)

 

I'm searching for example the code I could use to "lock" the zoom really close to the player for example  :)

 

But I don't know wich function I should call to prevent the player from de-zooming when he has lost his glasses for example...

 

Anyway, hope you guys could give me some leads  :-)

Link to comment
Share on other sites

I searched and I have found two ways to do it if you search for a way to do it :

 

The two next examples are used to force full zoom on the player, the value for it is 0.5, you may find the zoom value you want with :

getCore():getZoom(playerNumber)

"clean" way is all about finding the zoom value you want and prevent the user from changing it by doing the exact oposite action :

--Force constant zoomif (getCore():getZoom(playerNumber) > 0.5) then	getCore():doZoomScroll(playerNumber, -1);end

But this technique makes a zoom in zoom out effect that could be disturbing so you could use this method (less clean because you mess up with people's settings)

-- Enable ZoomgetCore():setOptionZoom(true);getCore():zoomOptionChanged();-- Zooming at maximumgetCore():doZoomScroll(0, -4);-- Disable ZoomgetCore():setOptionZoom(false);getCore():zoomOptionChanged();

If you use this code and have any questions, feel free to contact me  :-)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...