I need to change the camera angles at a constant rate, not at a decreasing rate.
I'm using the code from the script manual:
// Set an off-center projection, where perspective's vanishing
// point is not necessarily in the center of the screen.
//
// left/right/top/bottom define near plane size, i.e.
// how offset are corners of camera's near plane.
// Tweak the values and you can see camera's frustum change.
@script ExecuteInEditMode
var left = -0.2;
var right = 0.2;
var top = 0.2;
var bottom = -0.2;
function LateUpdate () {
var cam = camera;
var m = PerspectiveOffCenter(
left, right, bottom, top,
cam.nearClipPlane, cam.farClipPlane );
cam.projectionMatrix = m;
}
static function PerspectiveOffCenter(
left : float, right : float,
bottom : float, top : float,
near : float, far : float ) : Matrix4x4
{
var x = (2.0 * near) / (right - left);
var y = (2.0 * near) / (top - bottom);
var a = (right + left) / (right - left);
var b = (top + bottom) / (top - bottom);
var c = -(far + near) / (far - near);
var d = -(2.0 * far * near) / (far - near);
var e = -1.0;
var m : Matrix4x4;
m[0,0] = x; m[0,1] = 0; m[0,2] = a; m[0,3] = 0;
m[1,0] = 0; m[1,1] = y; m[1,2] = b; m[1,3] = 0;
m[2,0] = 0; m[2,1] = 0; m[2,2] = c; m[2,3] = d;
m[3,0] = 0; m[3,1] = 0; m[3,2] = e; m[3,3] = 0;
return m;
}
The cool thing about this code is by changing the "right" or "left", "up" or "down" variables I can make the left or right side of the camera widen. in other words I can make the right side of camera field of view 67 degrees or higher instead of the regular 60 degrees.
The only problem is this: it doesn't widen at a constant rate! its on some exponential rate thingy where if I type in .5 for right it'll widen it alot, but if I type in 1.0 it doesn't widen it as much as it did for .5. does that make sense I'll give you a made up example:
right = .2 = 30 degrees
right = .7 = 50 degrees
right = 1.2 = 60 degrees
see how I keep incrementing it by .5 (a constant rate) but the angle gets bigger at a decreasing rate.
Is there any way I can tweak the code above to make it widen the angles at a constat rate so that (for example):
right = .9 = 90 degrees
right = .1 = 10 degrees
??? please help me, this is the last hurdle in my project :)