Search Unity

2D collision box penetration problem

Discussion in '2D' started by Gushuman, Jun 10, 2020.

  1. Gushuman

    Gushuman

    Joined:
    Jul 27, 2019
    Posts:
    8
    2D collision box penetration problem


    Figure: Make a 2D billiard game

    I set both rigid bodies to continuous detection, and the result was that the collision box penetration would still occur when the object stopped moving, which was my 2D physical property setting

    upload_2020-6-10_19-16-43.png upload_2020-6-10_19-16-52.png upload_2020-6-10_19-17-4.png
     
  2. Zolaire

    Zolaire

    Joined:
    May 23, 2020
    Posts:
    21
    Move the code where you calculate movement to FixedUpdate
    then
    Try to decrease the time between collision detection.
    v
    Project Settings > Time > Fixed Timestep
     
  3. Gushuman

    Gushuman

    Joined:
    Jul 27, 2019
    Posts:
    8
    Thank you

    But the frame rate of the game is set in front and back synchronously and cannot be changed easily,

    It's best if there's another way