Press M to enlarge the minimap
Can anyone tell me how to enlarge the minimap by pressing m creating a gentle effect as lerp function? I have done this but the effect is abrupt and orrible.could you tell me how I could use the lerp function with this code or something that will give the same effect?
using UnityEngine; using System.Collections;
public class MinimapExpand : MonoBehaviour {
public Camera cam;
void Update ()
{
if(Input.GetKeyDown(KeyCode.M))
{
if(cam.rect.x == 0.76f)
{
cam.rect = new Rect (0f, -0.6f, 1.0019f, 1.61f);
}
else if(cam.rect.x == 0f)
{
cam.rect = new Rect(0.76f, 0.73f, 0.22f, 0.24f);
}
}
}
}
Answer by Injourn · Mar 03, 2016 at 09:11 PM
My best guess is to give every value of the rectangle its own variable and change the size of the each value using smooth damp when M is pressed and released.
Your answer
Follow this Question
Related Questions
If statement not getting called after Lerping a Scale 1 Answer
Text Objects do Lerp 0 Answers
Changing image color from other object's script (glitch)? 0 Answers
How to set destination for navmesh from minimap? 0 Answers
Lerping Camera Between Two Points 0 Answers