title: Unity3D Android - Move your character to a specific x position
body: <p>Im making a new game for android and I wanted to move my character (which is a cube for now) to a specific x location (on top of a flying floor/ground thingy) but I've been having some troubles with it.I've been using this script :</p>
  
  <pre><code>var jumpSpeed: float = 3.5;
  var distToGround: float;
  
  function Start(){
  // get the distance to ground
  distToGround = collider.bounds.extents.y;
  }
  
  function IsGrounded(): boolean {
  return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
  }
  
  function Update () {
  
  // Move the object to the right relative to the camera 1 unit/second.
      transform.Translate(Vector3.forward * Time.deltaTime);
  
  if (Input.anyKeyDown &amp;&amp; IsGrounded()){
  rigidbody.velocity.x = jumpSpeed;
  
  }
  }
  </code></pre>
  
  <p>And this is the result (which is not what I want) :</p>
  
  <p><a href="https://www.youtube.com/watch?v=Fj8B6eI4dbE&amp;feature=youtu.be" rel="nofollow">https://www.youtube.com/watch?v=Fj8B6eI4dbE&amp;feature=youtu.be</a></p>
  
  <p>Anyone has any idea how to do this ? Im new in unity and scripting.Im using java btw.</p>
  
  <p>Ty.</p>