- Home /
Collision Between 2D Rigidbodies is Jittery (No Movement)
Hi everyone. I have a setup where I have multiple rigidbodies with box colliders that are colliding with each other (you can see a video of that here).
There is no code involved for moving the boxes, and the reason they move is because of an Area Effector 2D that changes its Force Angle.
Here's some screenshots of the green and purple rigidbody components respectively:
Green: https://drive.google.com/file/d/1OwGi8-mm9Cfn2zVUsa1Pq4Egbppu8jfb/view?usp=sharing
Purple: https://drive.google.com/file/d/1Mp7xgqhkBy9Lhc087mKUUoL3YNuzZJRw/view?usp=sharing
What I need help with is the fact that the collisions between these rigidbodies cause jittery behaviour, and as you can see, this sometimes even forces the boxes to fall out of the map.
Any idea why this would be happening? I already tried changing rigidbody settings, and even the Baumgarte scales in the Physics2D project settings.
Would really appreciate some help, thank you in advance :)
Answer by Neomedus · Jun 22, 2020 at 02:00 AM
It seems like your objects may be clipping into each other, I would add code so that if they are touching, the area effector 2D won't add force in the direction that they are touching.
The thing is that if the force is not applied, there is no gravity to push them anywhere so the blocks would stay still.
I tried refactoring the whole system to use the default Physics2D gravity and changing that ins$$anonymous$$d, but the behaviour is exactly the same so I don't think the issue lies in the forces being applied constantly.
If you don't apply force to the rigidbodies can you set one one of them to kinematic? (I'm pretty new to unity so i apoligise if im missing some other point of dynamic bodies). Edit: I missed that you tried this already, but I'm confused that it didn't solve the problem, kinematic bodies canonly be moved from code, right?