A high mass gameObject pushes a low mass gameObject it makes weird bugs

I have 3 2D gameObjects, all have boxCollider 2D.

  1. The first one is a static gameObject.
  2. The second one is dynamic with mass 1
  3. The third one is dynamic with mass 1000
    If the third object is moving towards the static gameObject, then it will collide with it and stop.
    But if the the third object is pushing the second object, towards the static wall, it will not be right.
    Object 3 will only stop while it collides with the static wall, not when object 2 is.
    This creates a bug where object 3 is in object 2, which is of course not the behavior I want.
    It should stop when object 2 is colliding with the static wall.
    If object 2 has a mass of 10, it will still look weird but not as noticeable.

Set the collision detection mode to Continuous on both dynamic objects and use AddForce to move them.

It’s a simulation therefore it has its own constraints. We use Box2D which has a recommended maxiumum mass ratio of 10:1 not 1000:1.

Stability degrades as the mass ratio passes 10:1

Whilst continuous collision detection should help, there should be no need for you to use such high masses interacting with such small masses.

In real life, this wouldn’t be pretty either. :wink:

^ ^ ^ This. Ten to one ratio is already pretty big. If you wanna see the kind of instability that results, put two square rigidbodies on top of each other on a flat floor with a gap between them.

Make the bottom body mass = 1 and then the top one mass = 10 and press PLAY

While it’s running, try and increase the top one’s mass. It gets wiggy pretty quickly.

Same ratios for for speeds and distances.

Remember, all of these physics computations are done in 2 or 3 dimensional vectors with single-precision floating point numbers.

All that said, there’s some really popular successful games that had crazy physics glitches in them, such as GTA4:

Thanks, the reason I did 1000:1 in the first place, is because I want the big object to move the small, but I don’t want the big one slow down.
Is there a way to do this with this mass ratio?

You can use the force send/receive stuff but the problem here is that if the small one cannot stop it and the small is caught between a static collider and the large one, what do you expect to happen? It’s not going to stop!