title: horizontal movement in Unity
body: <p>I'm very new in Unity and I'm trying to move a simple square on a classic 2D map (Super Mario like).</p>
  
  <p>I use <code>addForce</code> to jump, it goes as planned.
  But now, I'm trying to move my character horizontally.</p>
  
  <p>First, I tried to use <code>tramsform.translation()</code>, I quickly notice that isn't the proper way, cause this method "teleports" the character, and if it moves too quickly, it can teleport behind a wall. I also try with <code>addForce</code>, but I want that my character has a constant speed, and it gives inertia, so it doesn't stop instantly when I release the key. I also try with <code>.MovePosition()</code>, but the character is shaking with this method (apparently, due to gravity).</p>
  
  <p>So, whats the proper way to move a character (Rigidbody2D) horizontaly?</p>
  
  <p>Here's my code with the different try:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  public class test : MonoBehaviour {
      private Rigidbody2D rb;
      public Vector2 velocity;
      public float jumpforce;
      // Use this for initialization
      void Start () {
          rb = GetComponent&lt;Rigidbody2D&gt;();
      }
  
  // Update is called once per frame
  void Update () {
      Debug.Log(velocity);
      if (Input.GetKeyDown("space")){
          rb.AddForce(new Vector2(0, jumpforce), ForceMode2D.Impulse);
      }
      if (Input.GetKey("a")){ // move to the left
          rb.AddForce(-velocity * Time.deltaTime, ForceMode2D.Impulse);
          //rb.MovePosition(rb.position - velocity * Time.fixedDeltaTime);
          //transform.Translate(-velocity);
      }
      if (Input.GetKey("d")){ // move to the right
              rb.AddForce(velocity * Time.deltaTime, ForceMode2D.Impulse);
              //rb.MovePosition(rb.position + velocity * Time.fixedDeltaTime);
              //transform.Translate(velocity);
          }
      }
  }
  </code></pre>