Rigidbody "melting" through each other. Solved(?)

Hopefully this is the right area to post. This is a weird thing that happened recently.

This is what it looks like:

The player is not jumping on the box, the player is partially penetrating the box and then being expelled upward (by Unity Physics). This stops happening if I turn on isKinematic, but that’s not a solution for my problem.

The 2 boxes and the player have a Collider and a Rigidbody. The player movement is controlled through Rigidbody.AddForce(). Why is this happening? Rigidbodies shouldn’t be going through each other.

There is no downward pressure being applied to the player. It just falls with regular Unity gravity.

I’ve tried physics solver count at 6, 15, 50, 100, 500. No difference.
Timestep is set to 0.01.
Max allowed is 0.1.

Edit: Update
More weird reactions:

If I place the small cube on top of the large cube, it behaves correctly. If the player then lands on top of the large cube as well, the small cube + the player begin to “sink” into the larger cube.

What kind of collider does the box have?

LOL it looks funny…

But in all seriousness I think that is a unity bug that I hope they fix in unity 5. I had this happen once to in a project I was working on, but was never able to fix it. it tends to happen when 3 or more rigidbodies are colliding at the same time it seems.

What method are you using to move the player?

EDIT: Nevermind, I missed that. Hmm, try changing the player’s collision method to Continuous Dynamic?

Regular Box Collider

Its already set to Continuous Dynamic. I’ve also tried setting the boxes to that as well but no difference.

I cleaned up the scene and left it at only 2 rigidbodies (player and 1 box), it still happens :frowning: Very frustrating indeed.

Can we see the code moving the player?

90% of the code is from a popular Asset Store Script so I don’t feel comfortable posting it. I’ve been in regular contact with the author and he has never seen this problem and has no solution. He thinks the answer might be some kind of Unity Physics setting.

Ah, I see. Are your objects extremely tiny? Also check the Min Penetration for Penalty in the physics section.

Nope. The small box is 1,1,1. The Player is ~1.8 units tall. I’ve even tried making the collider unplayably huge, it seems to help a bit but its still noticeable that some glitching is happening. I’ve also tried changing the player collider to a box collider, same results though it doesn’t penetrate as deeply.

Min Penetration is set to 0.01

Thanks for the suggestions!

Solved?

I… don’t know how or why. But its working.
I decided to re-assemble my player asset. Not re-write any code, just literally assigned all the components to a new gameObject. My model, scripts, etc. And it all just works.

Thanks to everybody that helped out!

1 Like

The second image sometimes describes me ;). Good to hear! Good luck with your game.