title: Continuous moving ball stuck at some time
body: <p>I am working on 2d game where monster with circular body moving continuously on screen. I have established grid which get filled by player movement so overall area for monster gets reduced based on player cover its area.</p>
  
  <p>Using following code monster is moving continuously but at some point it get stuck at some corner and stop moving.</p>
  
  <pre><code>public class EnemyMovement : MonoBehaviour
  {
   private bool isStartMoving;
   private Vector3 direction;
   private float sFactor = 10.0f;
   private float localScaleX, localScaleY;
  
   //
   public float cSpeed = 5.0f;
  
   void Start ()
   {
       InitializeValues ();
   }
  
   private void InitializeValues ()
   {
       localScaleX = transform.localScale.x;
       localScaleY = transform.localScale.y;
       float xDirection = Random.Range (0, 2) * 2 - 1;
       float yDirection = Random.Range (0, 2) * 2 - 1;
       direction = new Vector3 (xDirection * cSpeed, yDirection * cSpeed, 0f);
  
       rigidbody2D.velocity = direction;
       isStartMoving = true;
   }
  
   void FixedUpdate ()
   {
       if (!isStartMoving) 
           return;
  
       // current velocity
       Vector3 cVel = rigidbody2D.velocity;
       if (cVel == Vector3.zero) 
           return;
  
       // normalized vector * constant speed
       Vector3 tVel = cVel.normalized * cSpeed;
       if (tVel.x &gt; 0) 
           tVel.x = cSpeed;
       else 
           tVel.x = -cSpeed;
  
       if (tVel.y &gt; 0) 
           tVel.y = cSpeed;
       else 
           tVel.y = -cSpeed;
  
       rigidbody2D.velocity = Vector3.Lerp (cVel, tVel, Time.deltaTime * sFactor);
   }
  </code></pre>
  
  <p>}</p>
  
  <p>I have assign physics material in following manner.</p>
  
  <p><a href="https://i.stack.imgur.com/L0K2q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L0K2q.png" alt="enter image description here"></a></p>
  
  <p>Something like this type of situation happening with me.</p>
  
  <p><a href="https://i.stack.imgur.com/V5996.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V5996.png" alt="enter image description here"></a></p>
  
  <p>You clearly see in image bottom right corner monster is sleeping though continuous movement code is running. Please give me suggestion to improve this.</p>
  
  <p>From above code I removed following code :</p>
  
  <pre><code>if (cVel == Vector3.zero)
            return;
  </code></pre>
  
  <p>Then also my monster get stuck at corner position.Why monster is sleeping at corner position that I can't able to understand!!!</p>