PROBLEM: collision between two rigidbodies
Hi, i have a problem when two ridigbodies collide each other. When this happens, these two rigidbodies start to go backwards, as if there is a force that pushes them. I found a lot of posts about this problem, but with those solutions i could not fix my problem. I have two rigidbodies with sphere collider. Thank you.
Answer by gashraf · Aug 05, 2018 at 09:47 PM
Hi @claudiorota, You could try using a custom Physic Material (on Asset pane, right click --> Create --> Physic Material) to set the bounciness and friction properties and then use this material for your individual colliders on the game objects. Hope it helps you :)
Answer by claudiorota · Aug 05, 2018 at 10:50 PM
Thank you, @gashraf, i tried what you suggest me but my problem still there is. I tried also to disabled my script that controls player's movement when he hits other player , but he still moves under that mysterious force.
Try adding friction to the ground as well using the same method. When two moving bodies collide, they will naturally repel from each other due to conservation of momentum... m1.v1 = m2.v2. To dissipate the transferred energy, you can increase ground friction which would stop them soon. Also ensure that the collider material bounciness is 0 and damping is high.
If you want one of the bodies to remain still, and the other to bounce off it, e.g. a cannon ball hitting a tower, make sure you set the tower rigidbody to is$$anonymous$$inematic. That way it will serve as a passive object for others to collide against it.
Lastly you can try playing with the masses of the objects... lighter vs. heavier.
Answer by claudiorota · Aug 06, 2018 at 07:16 PM
@gashraf No, it doesn't work :( I think i have to handle something by script but i don't know what.