x


Weapon Movement Freezing

Guys, i made this weapon movement script but the gun is freezing... I tried to manually activate the function with the var "ON", It worked, but if i maximize the window the weapon keep freezing again :/

#pragma strict

var On : boolean;

var MoveAmount : float = 1;

var MoveSpeed : float = 4;

var Weapon : GameObject;

private var MoveOnX : float;

private var MoveOnY: float;

var DefaultPos : Vector3;

private var NewGunPos : Vector3;

function Update(){

if(On){

    MoveOnX = Input.GetAxis("Mouse X") * Time.deltaTime * MoveAmount;
    MoveOnY = Input.GetAxis("Mouse Y") * Time.deltaTime * MoveAmount;
    NewGunPos = new Vector3 ( DefaultPos.x + MoveOnX, DefaultPos.y + MoveOnY, DefaultPos.z);
    Weapon.transform.localPosition = Vector3.Lerp(Weapon.transform.localPosition , NewGunPos, MoveSpeed * Time.deltaTime);

}

}

more ▼

asked Apr 09 '12 at 11:56 PM

Marsallima gravatar image

Marsallima
31 20 24 25

(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:

x1362
x573
x261
x217
x12

asked: Apr 09 '12 at 11:56 PM

Seen: 357 times

Last Updated: Apr 09 '12 at 11:56 PM