One-way bounciness

I’m developing 2D platform game. Using 2d box colliders & rigid bodies I have three kinds of objects:

  • a Character
  • a Crate
  • a Platform

Since I don’t want Character to bounce off the Platform, but to stick to it, I set up both of their PhysicsMaterials to have Bounciness == 0. However I do want my Crate to bounce off the Platform when it falls from high enough, thus I decided to set its Bounciness to 0.2 (for now). The problem is that my Character bouncess off the Crate too now, which is undesirable.

It wouldn’t be much of an issue, because it’s hardly noticable at all… However it causes the falling animation for the Character launch several times. The trigger on the mecanim Animator that fires the animation is a bool parameter IsFalling, which I set to true, whenever Character’s rigidbody’s vertical velocity is lower than -0.001 (I had to put some threshold to avoid float precision causing my animation to fire).

It looks quite bad and I thought it’s the best to address the root cause of the problem - my Character shouldn’t bounce off the Crate at all. However from my research it seems that bounciness parameter of the Physics material always works two way and selects the net bounciness of any two objects following the maximum rule - the bigger one will be the bounciness for both of them. Unless there is a way to set this up somehow, of which I’m not aware?

The only thing I can think of now is just zeroing the vertical velocity of a Character once it lands on anything, but it looks like a bit of an workaround instead of addressing the real problem…

Well, unfortunately the 2d physics material doesn’t have the combine options that the 3d physics material has. However the overall concept of having different results for the same collision is actually not physically correct. A collision is either elastic, inelastic or something in between. Therefore the result would correctly apply to both participants of a collision. So it seems that you can’t get the 2d physics system to do that unrealstic behaviour you want. So zeroing the vertical velocity on collision might be the best solution.

See this question for reference