# Moving an object with just a key tap.

**URL:** https://discussions.unity.com/t/moving-an-object-with-just-a-key-tap/875710
**Category:** 2D
**Tags:** 2D
**Created:** [March 22, 2022, 4:32pm UTC](https://discussions.unity.com/t/moving-an-object-with-just-a-key-tap/875710 "2022-03-22T16:32:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pedalgains](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pedalgains](https://discussions.unity.com/u/pedalgains)
#### Post date: [March 22, 2022, 4:32pm UTC](https://discussions.unity.com/t/moving-an-object-with-just-a-key-tap/875710/1 "2022-03-22T16:32:24Z")

</div>

Hello all,

I’m developing a little card game where the cards show directions a player can move. You draw your cards, drag and drop the ordering of them and then press a key to play through the directions. Up, Up, Left, Right, for example. The issue I’m having is moving the object smoothly in the right direction instead of it “jumping” to its position.

---

<div class="post-metadata">

### Author: ![RafaelGomes00](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/rafaelgomes00/32/949114_2.png) [@RafaelGomes00](https://discussions.unity.com/u/RafaelGomes00)
#### Post date: [March 22, 2022, 5:37pm UTC](https://discussions.unity.com/t/moving-an-object-with-just-a-key-tap/875710/2 "2022-03-22T17:37:47Z")

</div>

use Mathf.Lerp

> **[Unity - Scripting API: Mathf.Lerp](https://docs.unity3d.com/ScriptReference/Mathf.Lerp.html)**

---

<div class="post-metadata">

### Author: ![Kurt-Dekker](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kurt-dekker/32/101578_2.png) [@Kurt-Dekker](https://discussions.unity.com/u/Kurt-Dekker)
#### Post date: [March 22, 2022, 7:19pm UTC](https://discussions.unity.com/t/moving-an-object-with-just-a-key-tap/875710/3 "2022-03-22T19:19:18Z")

</div>

> [@pedalgains](#):
>
> The issue I’m having is moving the object smoothly in the right direction instead of it “jumping” to its position.

Either use Mathf.Lerp() as Rafael notes, or Mathf.MoveTowards(), or move it gradually yourself… OR…

Step up above all that silly microcoding and use a tweening package such as **LeanTween** or **DOTween** , both of which are free on the asset store and can do just about everything you need for any game.
