I have no idea why, but the gun goes to the other side of the map
Here is the code:
//variables
var gun : Transform;
var aimSpeed : float = 5.0;
var normalPos : Vector3;
var aimPos : Vector3;
//under function update
if(Input.GetButtonDown("Fire2")){
gun.transform.position = Vector3.Lerp (transform.position, aimPos, Time.deltaTime * aimSpeed);
}
else
{
gun.transform.position = Vector3.Lerp (transform.position, normalPos, Time.deltaTime * aimSpeed);
}
Anything wrong?
(The script is not separate, it is inside another shooting script)