Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OnTriggerEnter firing too late, OnCollisionEnter too early

Discussion in 'Physics' started by fleacoco, May 28, 2019.

  1. fleacoco

    fleacoco

    Joined:
    Mar 6, 2019
    Posts:
    5
    Hi everybody,

    I'm trying to make a sticky grenade by disabling its rigidbody upon collision. However : - OnCollisionEnter() is firing to soon : the collision is detected offset the object. As a result the grenade sticks next to the obstacle, whereas no collision should be detected. - OnTriggerEnter() is firing too late : the collision occures once the grenade is inside my enemy or my obstacle.

    OnCollisionEnter is definitely not working so I sticked to OnTriggerEnter but as a result the grenades disappears inside the objects (I'm making dirty workaround to move the grenade outside the object after the collision but it's really bad). I added rigidbody & continuous collision detection but its not better.

    Thanks in advance for your help
     
  2. TheNextBigThing7

    TheNextBigThing7

    Joined:
    Jan 29, 2018
    Posts:
    1
    It would help if you provided the script.