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

Resolved Pinched rigidbody escapes through a collider

Discussion in 'Physics' started by Maskedchamo, Sep 20, 2021.

  1. Maskedchamo

    Maskedchamo

    Joined:
    Mar 12, 2018
    Posts:
    23
    Hi,

    I making a brick breaker game, and when the paddle pinches the ball against a side wall, the ball escapes through the wall.

    The walls are using the OnTriggerEnter event and a Vector2.reflect to simulate the bounce. In the following situation, the ball would go through the wall on the right side of the picture, eventually ignoring the OnTriggerEnter event.


    physics_question.png

    I am considering disabling the collisions between the ball and the paddle for a short period of time when this happens to prevent the ball escaping.

    Has anyone got any suggestion to prevent the ball from escaping in such a situation?

    Thanks in advance.
     
    Last edited: Sep 20, 2021
  2. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    Continous collision detection
     
  3. Maskedchamo

    Maskedchamo

    Joined:
    Mar 12, 2018
    Posts:
    23
    Thanks r31o.

    Actually continuous detection wasn't enough. I switched the walls to static rigidbodies and it seems ok now. Somehow the collision detection didn't seem to work the same way with trigger only collider.