Okay, so i’m making a menu for my game and I want it when you click a part of the screen the camera will slide to a menu option. The only problem is its not sliding its just changing position, no motion in between. Here is the code:
var Point1:Vector3;
var Point2:Vector3;
var Point3:Vector3;
var point = 2;
function Update () {
if (Input.GetMouseButtonDown(0))
{
if (Input.mousePosition.x < 450 && point != 1)
{
Debug.Log("left");
point -= 1;
left();
}
if (Input.mousePosition.x > Screen.width-450 && point != 3)
{
Debug.Log("right");
point += 1;
right();
}
}
}
function left()
{
if (point == 1)
{
transform.position = Vector3.Slerp(Point2, Point1, Time.time);
}
if (point == 2)
{
transform.position = Vector3.Slerp(Point3, Point2, Time.time);
}
}
function right()
{
if (point == 2)
{
transform.position = Vector3.Slerp(Point1, Point2, Time.time);
}
if (point == 3)
{
transform.position = Vector3.Slerp(Point2, Point3, Time.time);
}
}
any help is appreciated!