Search Unity

Question Polygon Collider 2D behaving differently in IOS App

Discussion in 'Physics' started by sectort, Jan 12, 2023.

  1. sectort

    sectort

    Joined:
    Feb 23, 2022
    Posts:
    1
    I have created a prefab which is square with rounded corners. The attached components are Rigidbody 2D and Polygon Collider 2D. A Physics Material 2D is used for both components with Friction: 0.4 and Bounciness: 0. Multiple of these prefabs are dropped from the top of the screen and collide with each other at the bottom of the screen and stack on top of each other.
    • On Android devices, it's working as expected. There is no bounce and when the objects are done falling they don't move.
    • On IOS, with the same settings, the objects bounce a bit and after done falling they continuously move and shake slightly. Multiple times this is causing the object to merge together. Screen Shot 2023-01-12 at 3.37.59 PM.png Screen Shot 2023-01-12 at 3.38.10 PM.png
     
  2. darvelito

    darvelito

    Joined:
    May 20, 2017
    Posts:
    1
    I'm having the same problem. Using Unity as a Library, I have two square RigidBody2Ds, with one being a player, both having BoxCollider2D. On Android or macOS preview the squares fall and land on platforms, on iOS they bounce into the sky!

    Am I doing something obviously wrong here? No scripts were created.

    I didn't have this problem with Unity 2021 LTS but I do with 2022.2 and 2023.1. But since UaaL requires 2022 for Android I upgraded and can't find a solution to this problem anywhere.
     

    Attached Files:

    Last edited: Apr 4, 2023
  3. vlad_brainamics

    vlad_brainamics

    Joined:
    Jan 29, 2023
    Posts:
    2
    did anyone solve it? this is ridiculous. It works as intended in the simulator and on Android: the boxes land on the ground. but on iOS the colliders fall through each other (see video)

    - Unity: 2022.2.16f1
    - Ground has a static RigidBody with a Box Collider 2d and a standard 2d material (0.4, 0)
    - Boxes have dynamic Rigidbody 2d with continuous collision detection (also tried the discrete option) and a material (0.4, 0.1)
     

    Attached Files:

  4. vlad_brainamics

    vlad_brainamics

    Joined:
    Jan 29, 2023
    Posts:
    2
    What I ended up doing is to set a ground collider as kinematic and freezing all the coordinates (before it was static)

    There are a few good links that explain different behaviors:
    How to stop falling through floors and colliders in Unity – John Stejskal : Software and Game Developer
    https://diegogiacomelli.com.br/apps/collider-interactions/

    What is not explained anywhere, though is why the hell it has problems only on iOS...
     
  5. JohnnyTravel

    JohnnyTravel

    Joined:
    Sep 16, 2022
    Posts:
    2
    I have exacty this issue, too - works fine on other builds except iOS/XCode, where the colliders appear to stop working correctly. Is it a known bug that I should wait for an update, or is there a way around it?
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,487
  7. JohnnyTravel

    JohnnyTravel

    Joined:
    Sep 16, 2022
    Posts:
    2
    Thanks for the update and apologies for the lack of description.
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,487
    No problem, it's the only bug reported for 2D physics currently and I'm working exclusively on it now (for the last few days TBH). Bit of a devil of a bug to track down!