Hey Guys,
This is my first time and I might miss something oblivious, but simply i am trying to move a game object (In this case a Gun) to a new position in front of the camera, but it won’t do anything. I tried different ways using vectors but it wont budge. Here is the code.
`using UnityEngine;
using System.Collections;
public class Zoom : MonoBehaviour
{
public bool Aim = false;
public GameObject GunAuto;
void update()
{
if (Input.GetButtonDown("E"))
{
Aim = true;
}
if (Input.GetButtonUp("E"))
{
Aim = false;
}
if (Aim == true)
{
GunAuto.transform.position = Vector3.Lerp(GunAuto.transform.position, new Vector3(0.05678606f,-0.4925618f,0.4183655f), 1.0f);
}
if (Aim == false)
{
GunAuto.transform.position = Vector3.Lerp(GunAuto.transform.position, new Vector3(0.410768f,-0.5168345f,0.81342f), 1.0f);
}
}
}
Help and suggestions needed!