# How to prevent Dynamic Rigidbody2d with large mass pushing another Rigidbody2d into BoxCollider2D

I'm making a prototype for a game idea but hitting a problem :(

Quite new to Unity and feel like this should be relatively easy to solve, but keep going around in circles, and hoping to get some help :)

GameObjects:

• Red box: has BoxCollider2D
• Duck: has BoxCollider2D, Rigidbody2D (dynamic), some scripts
• Wall: has BoxCollider2D, Rigidbody2D (dynamic), some scripts

Rules:

• Red box: doesn't move, everything should stop when colliding with it
• Duck: moveable by player, can't push "Wall"
• Wall: moveable by player, can push "Duck"

To get "Wall can push Duck, but Duck can't push Wall" working, I set the Mass for Wall to be Infinity. However, this seems to have a side effect where Wall can now push Duck through Red box. Note: even increasing mass to something like 500 has this side effect too

If the mass for Wall is smaller, then it won't push Duck through Red box. However, with the smaller mass, Duck can then push Wall (which I don't want).

The script for moving Wall is:

private void FixedUpdate()
{
// https://learn.unity.com/tutorial/world-interactions-blocking-movement?uv=2019.2&projectId=5c6166dbedbc2a0021b1bc7c#5ce3cdabedbc2a3ce61754e8
Vector2 position = rigidbody2d.position;
position.x += speed * horizontal * Time.deltaTime;
position.y += speed * vertical * Time.deltaTime;
rigidbody2d.MovePosition(position);
}


Question:

1. What should I do so "Wall can push Duck, but Duck can't push Wall" holds true, without Duck being pushed into the Red box.
2. Should I be using Dynamic Rigidbody (sort of physics with collisions and pushing), or Kinematic Rigidbody (and handle collisions and pushing manually)?