I have had some trouble locating an example online as to what I am trying to achieve; I am not the greatest at math so I will explain the issue the best I can.
Usage: I have a camera in world space that orbits a target on all axes. The issue this is focused on is moving the camera closer or further away from the target. Now, I have a basic method that works really well for the basic problem. However, the issue I have now is that the camera zooms at a constant rate no matter how close it is to the target (it should zoom slower the closer it gets).
delta is a value between
120; this is supplied from the scroll wheel of the user's mouse.
Speed: The variable
speed is the reason I am here. I can set this to a value of
3 and zooming is nice and smooth at a constant rate. If I set this to a value of
1000 then the zooming becomes incredibly slow, but remains smooth. This is the desired effect but it needs to be adjusted based on the distance between the camera and the target.
The distance between the camera and the target is essentially the opposite of the speed variable. Meaning, when the camera is further away, the distance is obviously larger; when the camera is closer, the distance is obviously smaller. This creates an issue where if I just use the distance then the zooming gets slower as I zoom out, and as I zoom in it gets faster.
The Question: How do I take a range such as
3 - 1000 and reverse it to where it becomes
1000 - 3?
Note: As I stated previously, I am not the greatest at math so I don't know a lot of the correct terminology and this question is probably not the greatest, but I am trying to be as thorough as possible to assist in the process. Also, if the tag is not correct, please feel free to adjust it.