Im making a FPS game and its all working good but the only thing i am having a problam with is the amining down your gun sights basicly changing the position of the gun i used the dastardly banana scripts there good but they have errors
ive been searching for weeks but i cant seem to find one that works i even tried riting my own but that didnt work ive had about 1 year experience in unity and im starting to understand vectors bacicly what i whant is so when you press the right mouse key you aim in smoothly and when you let go it aims out to the same place.
This is what ive used but it never gets to the right place.
var start : Transform;
var end : Transform;
function Update () {
if (Input.GetButtonDown("Fire2"))
transform.position = Vector3.Lerp(start.position, end.position, Time.time);
if (Input.GetButtonUp("Fire2"))
transform.position = Vector3.Lerp(end.position, start.position, Time.time);
}
Thank you for reading