title: Unity 2D Collisions and movement with Lerp
body: <p>So I have the player with a Rigidbody2d and a box collider 2D with continuous collision detection and dynamic body type. The boxes the player must jump on are dynamic until they have fallen when their rigidbody gets destroyed to stop the wobbling, the box also has a collider 2d on it yet still the player can move through it. The player must move with a lerp as it must only move a certain distance. I'm pretty sure this is the problem, however, I don't know how t fix it. I have multiple raycasts which work very well except when the player lands on the box diagonally. Any help would be much appreciated.alt text</p>
  
  <p>Thanks</p>
  
  <pre><code>    void update(){
      if (Input.GetAxis("Horizontal") &gt; 0 &amp;&amp; moveRight == true &amp;&amp; moveRightTimer &lt;= 0)
          {
              moveRightTimer = 0.15f;
              moveX += moveDistance;
              if(gameObject.transform.localScale.x &lt; 0)
              {
                  flipPlayer();
              }
          }
      }
      void FixedUpdate()
          {
              MovePlayer();
          }
      //Moves the player
      void MovePlayer()
      { 
          Vector2 PlayerPos = gameObject.transform.position;
          PlayerPos.x = moveX;
  
      GetComponent&lt;Rigidbody2D&gt;().MovePosition(PlayerPos + (Vector2)transform.position * Time.deltaTime);
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/FuFU5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FuFU5.png" alt="enter image description here"></a></p>