I have a player who i control with tilting. Also i have some game objects (something like ground or areas where player can not move). The problem is that if these objects are too small the player can pass through them. If the objects are big the result is also undesirable. The result is something like knock back effect. The player collide with another object and then the object push back player. It's look like player is shaking .That effect happen almost every time when the collide.

    Player has:
  • standard rigidbody2d
  • box collider 2d with material (Friction and Bounciness are 0)
  • tilt script:transform.Translate(Input.acceleration.x * speed, Input.acceleration.y * speed, 0);
    The another objects have:
  • box collider 2d.

closed as off-topic by Josh Nov 3 '15 at 19:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Looks like the problem is your use of transform.Translate. This just teleports the object to the new position, without interacting with physics along the way. Once it arrives, it will often be embedded in another collider, and the physics engine will forcibly separate them, creating the knock back effect you describe. Rather than manipulating the object's transform directly, you should apply forces or velocities to its rigidbody2d component. That keeps all the movement under the control of the physics engine, and it can resolve collisions without interpenetration and excess jitter. \$\endgroup\$ – DMGregory Nov 5 '15 at 4:37
  • \$\begingroup\$ You are right. It's works great when i apply force to rigidbody2d. Thanks ! \$\endgroup\$ – chunk1ty Nov 12 '15 at 20:54

Browse other questions tagged or ask your own question.