Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Wierd RigidBody collisions in 2D

Discussion in 'Physics' started by fischerjo2506, Aug 8, 2023.

  1. fischerjo2506


    Jul 13, 2023
    I tried using the "Interpolate" setting on my rigidbody, but now the object simply ignores all collision. I dont know if that has to do with the way I am moving it (rigidbody.transform.Translate(moveDirection)) or with the collision in my tilemap (I use a tilemap collider combined with a composite collider, in the editor the collision-lines look fine). I am pretty new to Unity and probably miss something easy. Can anyone help?
    (You can see my Player Rigidbody and the tilemap in the attached files)

    Attached Files:

  2. Kechrimpari


    Apr 5, 2022
    Interpolate is supposed to smooth out jittery movement, so I don't know why that would affect your collision. What do your colliders look like?
  3. MelvMay


    Unity Technologies

    May 24, 2013
    Interpolation has no effect on physics itself. It's purely a function of the Transform to move it from the last body pose to the current one; nothing more.

    This is just "transform.Translate()" (you can get the Transform from any component) and it isn't physics movement; it's bypassing physics completely and forcing the Rigidbody2D to read that position when the simulation next runs. Don't ever modify the Transform if you want to use physics because the whole point of a Rigidbody2D is to Write to the Transform.

    Always use the Rigidbody2D API to cause movement. Take a look at the scripting reference or follow one of the many tutorials showing you 2D physics movement.

    If you're doing this because of any tutorial then find another tutorial, it's never going to give you good results.