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.
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.
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.
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.
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.