Posted By: Siwler
Zoom in/out with mikey - 03/14/12 00:03
Hey guy, asking for some help please?
I'm trying to convert/use this code:
But I get an error for the min undeclared identifier, so I took that line of code out(camera.arc = min (max (camera.arc, 10), 120);). Now when I zoom it to its max zoom camera.arc resets automatically and scope_pan also resets to hide position.
How do I fix this?
Here is my converted or just a code that I'm working with light-C:
I'm trying to convert/use this code:
Code:
starter wheel_zoom() { while (1) { if (mickey.z > 1) { camera.arc += 10 * time; // play with "10" } if (mickey.z < -1) { camera.arc -= 10 * time; // play with "10" } camera.arc = min (max (camera.arc, 10), 120); // limit camera.arc to 10..120 wait (1); } }
But I get an error for the min undeclared identifier, so I took that line of code out(camera.arc = min (max (camera.arc, 10), 120);). Now when I zoom it to its max zoom camera.arc resets automatically and scope_pan also resets to hide position.
How do I fix this?
Here is my converted or just a code that I'm working with light-C:
Code:
while (camera.arc > 10) // zoom in until camera.arc is smaller than or equal with 10 { if (mickey.z > 1) { camera.arc += 10 * time_step; // 10 gives the zoom-in speed } if (mickey.z < -1) { camera.arc -= 10 * time_step; } camera.arc = min (max (camera.arc, 10), 120); wait (1); } // the maximum zoom-in factor has been achieved here camera.pan += (5 - random(10)) * 0.01 * time_step; // time to add fatigue to the mix camera.tilt += (5 - random(10)) * 0.01 * time_step; // the pan and tilt angles of the camera will change a bit, as if the player was tired, the wind was blowing, etc }