rigidbody2d bounce
Hello,
I've stumbled upon a serious problem.
I create three square objects and placed them like this:
under them there is a simple Box Collider 2D object which they fall on to.
And the problem is no matter what I do, after the boxes land on each other after the launch
they a bit like shift off of each other, and I cant fix it.
In detail the upper block "c" first goes down to the Y -2.36 but then slides up a bit to Y -2.35.
I tried to create a material with the bounce set to 0.
Linear drag set to 0, angular set to 0, constraints on the axis X.
nothing helps.
Don't know what do to, please help me.
Answer by ComradeVanti · Mar 19, 2016 at 02:14 PM
Probably just some unity-collider-fun happening here. There will always be a bit of inconsistency. If this really is a sirious problem to you, try fixing the blocks with a script when they are in the right position.
If you are not happy with this answer please comment on it and discribe what exactly you are trying to achieve :)
Upon googling further I've discovered that the issue is called the collider penetration problem and there is nothing really to do about it, but to move the object somehow differently or to fix their positions once they are in place like you suggested.
I guess I'm gonna have to move the objects by scripts and disable physics alltogether.
Answer by MelvMay · Mar 19, 2016 at 08:09 PM
Use continuous collision detection on the Rigidbody2D; it's more expensive but it detects exact contact points. Discrete is the default because its faster and for most purpose work well however it doesn't cast shapes like continous does so can produce overlaps or even completely tunnelling.