This might be a stupid question, but is it possible to use transform.localScale along with acceleration? I can increase/decrease the height of my gameobject on certain keypresses, but I want the scaling to speed up gradually until it reaches a certain speed, and when I release the key I want the scaling to decelerate before it stops completely. Right now my gameobject scales instantly, which is not very realistic.
This is the code I have so far:
void Update() {
if (Input.GetKey(KeyCode.UpArrow)) {
transform.localScale += new Vector3(0, 0.1f, 0);
}
else if (Input.GetKey(KeyCode.DownArrow)) {
transform.localScale += new Vector3(0, -0.1f, 0);
}
}