x


Animations are jerky? with FOV and aspect ratios

so i have a sniper rifle and my aim down sights is a combination 2 scripts, one that changes the main cameras field of view and another that plays an animation to bring the sniper to eye level. both while holding right click

the FOV works and the animation stops before it reaches eye level sometimes it will jerk and get stuck also if i have maxmize on play selected it will always jerk or any other size then 2 by 3

for the animation below

var AnimName ="scopeinsniper";

//private var resetTime = .0000000000000000;

var useBackwards = true;

function Update (){

if(useBackwards==true){

if(Input.GetMouseButtonDown(1)){

animation[AnimName].speed = 2;

//animation[AnimName].time = resetTime;

animation.Play(AnimName);

}

if(Input.GetMouseButtonUp(1)){

animation[AnimName].speed = -2;

//resetTime =animation[AnimName].time;

animation[AnimName].time = animation[AnimName].length;

animation.Play(AnimName);

for FOV

public var FOVIN :float = 35;

  public var FOVSpeed :float = 5;

    public var Aim : boolean = false;

     public var DeffFOV : float;

      public var CAM : GameObject;

function Awake(){

DeffFOV = CAM.camera.fieldOfView;

}

function Update () {

 if(Input.GetMouseButtonDown(1)){

  Aim = true;

} if(Input.GetMouseButtonUp(1)){

  Aim = false;



}


       if(Aim){

       CAM.camera.fieldOfView = Mathf.Lerp(CAM.camera.fieldOfView, FOVIN , FOVSpeed * Time.deltaTime);

       }

       if(!Aim){

       CAM.camera.fieldOfView = Mathf.Lerp(CAM.camera.fieldOfView , DeffFOV , FOVSpeed * Time.deltaTime);

       }

}

more ▼

asked Oct 20 '11 at 11:58 PM

ibayibay1 gravatar image

ibayibay1
3 2 3 4

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3935
x461
x59
x23
x13

asked: Oct 20 '11 at 11:58 PM

Seen: 720 times

Last Updated: Oct 20 '11 at 11:58 PM