Search Unity

Detect collision point OnTrigger2DEnter

Discussion in 'Physics' started by Kousen10, Aug 10, 2020.

  1. Kousen10

    Kousen10

    Joined:
    Jul 23, 2020
    Posts:
    23
    Hello,

    Basically as my title says, I am facing a problem to detect the collision point within the OnTrigger2DEnter function.

    I am aware that the argument of this funtion is a Collider2D and it has no access to the collision points but in my case I believe I need to access them somehow...

    I have a bullet object that uses physics so it cannot be a kinematic object. Additionally, this bullet object is a trigger, so as soon as it touches any other collider, it triggers the OnTrigger2DEnter function and inside this funciton I instantiate the bullet impact effect. The impact effect animation is drawn at the top of the bullet sprite, so the problem comes when the collision with the bullet happens from behind so the impact effect animation happens at the top of the bullet (as mentioned before), which means that it is not going to appear on the collision point...

    Correct collision at the front of the collided object:
    upload_2020-8-10_9-39-12.png

    Incorrect collisition at the back of the collided object:
    upload_2020-8-10_9-40-6.png

    So summary would be: is there any way to detect the collision point if I cannot use a non-kinematic object?

    Thank you very much in advance!
     
  2. Kousen10

    Kousen10

    Joined:
    Jul 23, 2020
    Posts:
    23
    Anyone?