Collisions occassionaly fail.

Ok, so i’ve had a look at a few other “collision not working” posts, but have yet to find a solution that works for me.

Also, as a note, this issue is not a constant issue, it seems to happen very occasionally, and so is a pain to reproduce.

I have an object with a sphere collider, a rigid body using gravity, and then a second object with a collider set to a trigger. the rigidbody object is flung at the other (and the trigger object, and speeds of the flung object should not be creating the bullet through paper problem), The object hits the collider and fires collisions properly 9/10 times, but that 1/10 times it just flies straight through, without calling the collision. (i’ve tried this using all 3 collision modes on the rigid body, and various levels of solver itterations in physics settings).

Granted, this could just be one of those issues where in very perfect conditions, the fling of the object gives it just enough force to go through the collider. but with the rarity of it, and the scaling attempts i’ve made to the collider cause me to doubt this possibility a lot.

Does anyone else have any idea what might be causing this issue?

mark the collision Detection in rigidbody as continous dynamic for both objects and try it.

read up about it some there.

You don’t want to use that setting but you can probably use it to rule out the object “flying” through it because of the projectile speed.

If it doesn’t go through with them set to that after 50 tosses then you know it is in fact flying through undetected.

You might also simply slow the object down, the simple fact is if it always triggers at 1mph and only sometimes triggers at 2, like it or not its the mph difference.
Lastly of course you can way exagerate the size of the collision box, make it 10 or 20 times as deep where its being hit.

So go ahead and slow it WAY down or make the box WAY big to make certain this isn’t the issue not just you doubt it is.

It sounds like it is in fact exactly the issue because you are getting collisions just not all the time.

I am having the same issue, I am writing an arcade style space shooter where collisions need to be perfect. No luck so far, although the problem appears only once in 5 minutes playtime or so (many collisions in that time)…

Had a similar issue. The Player asset designer had added box colliders to each component of the Player asset and then an overall box collider to the entire object. Apparently, that was just a bit too much for the engine to comprehend. Removing all the individual box colliders and just sticking with one overall solved the issue…

If you do not want to alter fixed update time another solution is to monitor the projectile or w/e for a collision by its velocity. Basically once the velocity slows down by a minimum of ‘x’ amount there was likely a collision. Here is my solution to this, I am checking for a collision or change in velocity.

private void OnTriggerEnter2D(Collider2D collision)
        anyCol = true;

public IEnumerator DoUntilUntilCol()
    anyCol = false;
    float lastVel = 0;
    float curVel = 0;
    while (!anyCol || curVel < lastVel)
        curVel = rig.velocity.magnitude;
        Debug.Log("VELOCITY: " + rig.velocity.magnitude);
        if (curVel >= lastVel)
            lastVel = curVel;
        yield return new WaitForFixedUpdate();
     yield return null;