- Home /
 
 
               Question by 
               tomsuvuinhon2473 · Mar 25 at 08:45 AM · 
                collisionrigidbodyboxcollidermoveposition  
              
 
              Collision not working as intended with rb.MovePosition
I'm watching the unity Tank! Tutorial and trying to implement it to my own empty game. My movement code is:
 private void FixedUpdate ()
     {
         Move ();
         Turn ();
     }
 
     private void Move ()
     {
         Vector3 movement = transform.forward * m_MovementInputValue * m_Speed * Time.deltaTime;
 
         m_Rigidbody.MovePosition(m_Rigidbody.position + movement);
     }
 
 
     private void Turn ()
     {
         float turn = m_TurnInputValue * m_TurnSpeed * Time.deltaTime;
 
         Quaternion turnRotation = Quaternion.Euler (0f, turn, 0f);
 
         m_Rigidbody.MoveRotation (m_Rigidbody.rotation * turnRotation);
     }
 }
 
               The tutorial's Complete game scene works just fine with its collision. But when I use the tank in another sample scene or make a new tank from scratch with the same code in a new project, the tank can push through box collider like jelly. I tried the collision detection with all settings, but none worked.
               Comment
              
 
               
              Show inspector of tank object, are you adding collision and rigidbody?
The tank has a proper box collider and rb, and the wall is just an empty object with a box collider, the tank can push through the wall similar to jelly. 
 
                     
                    screenshot-150.png 
                    (435.4 kB) 
                   
 
                  Your answer