Search Unity

Problem with system Physics.Raycast on android devices

Discussion in 'Physics' started by Dageor, Jan 11, 2019.

  1. Dageor

    Dageor

    Joined:
    Aug 4, 2016
    Posts:
    6
    Hey. I use the Physics.Raycast system to analyze the obstacles in the game, so that the character can perform various tricks depending on the obstacles and I am faced with the following problem:
    in unity, everything works well, and the obstacles are displayed correctly, when I collect everything on the ios platform, it's also good, but when I collect on the android platform, I see the following situation: from time to time Physics.raycast stops to collide with any objects that fall into its review ( only restarting the scene helps to solve). I tried to create a scene in which there was only one swivel beam per cube, and even on it on android devices, over time, raycast ceased to interfere with physics. If there were two such objects on the stage that did not depend on each other, the raycast was turned off on both. Has anyone encountered such a problem, if it came across, how did it solve it? I use unity 2018.2.20, switching to version 2018.3.0 did not solve the problem. I cannot return to Unity 2017, since the project immediately breaks all the prefabs
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Try to recreate the bug in a demo-project, if it works in 2017 and not in 2018 submit a bug report with the demo-project attached.

    sorry I can't provide more help, PC dev here.
     
  3. Dageor

    Dageor

    Joined:
    Aug 4, 2016
    Posts:
    6
    I was able to port the project to unity 2017. The problem with raycast is not gone. Could it be that due to the rays appearing inside the Collider, Raycast would shut down?
     
  4. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    I'm not sure I understand you right, but if a ray starts inside a collider I don't think it will detect said collider.
     
  5. Dageor

    Dageor

    Joined:
    Aug 4, 2016
    Posts:
    6
    If a Raycast is born once inside the collider, then the next time, if it is born outside of it, it ceases to collide with objects.
     
  6. Dageor

    Dageor

    Joined:
    Aug 4, 2016
    Posts:
    6
    I watched the console after the build on android devices, and it does not produce a single error (it just stops the raycast from colliding with objects)
     
  7. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Submit a bug report.
     
  8. Dageor

    Dageor

    Joined:
    Aug 4, 2016
    Posts:
    6
    I found what the problem was. As it turned out the problem was not at all in the Raycast system. I used the Unity Cinemachine plugin and realized that CinemachineCollider breaks the Physics.Raycast system on android devices