I am trying to make it so that a player can move a box, and I did it, but I have an unpleasant effect. When a player tries to push an edge of the box, he (I am not 100% sure) goes a little bit through it several times, and I don’t how to get rid of the unpleasant effect .
I created two rigidbody2d bodies. For rigibody2d which is a player I apply force to move and a damp to slow him down. I also enabled physics interpolation in the project settings. I tried to set linear velocity instead of applying force, but I didn’t notice changes. I tried to set in both rigibodies continuous to cast shape but it didn’t help.
I can’t Upload files here because I am a new user. So uploaded a video on google dirve for better understanding.
Could be slightly inaccurate collision shapes; maybe the damping is too high. Physics interpolation could also present that way for a frame or two, but should settle down quickly.
I tried to increase mass and decrease the damp of a box, but I effect is still there. With disabled physics interpolation, nothing changed. And what do you mean by saying inaccurate collision shapes?
What @gertkeno means by “inaccurate collision shapes” is perhaps the shape of the collision geometry isn’t quite correct.
It looks to me like you’ve got a circle and a square with rounded corners for your sprites, but the underlying collision shapes aren’t quite the same. I think you’d get the results you were seeing if the circle has an identical circular collision area (that is, same radius as the sprite), but the roundsquare has a square collision area that’s slightly smaller than its sprite.
You mean that everything is fine with physics and the reason for the effect is that a collision is smaller than a sprite, and it creates the effect of a circle going through a box? Is there a way I can increase the “polygons” of the circle to check it?
The polygons of the circle are merely for rendering, mathematically the circle is perfect. If you slightly increase it’s size past the visual does it work better?
I increased the size of collision of player and increased “Contact Max Allowed Penetration” from 0.3 to 2.5 and the effect became barely noticeable, so I think this can be considered a solution to the problem.