I really don’t understand why this is happening. I literally have the same code working on some other projectile that works just fine (the one that works is bigger, however).
Here’s my code:
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag != "Enemy" && !other.isTrigger)
{
collider.isTrigger = false;
}
}
void OnCollisionEnter2D(Collision2D other)
{
otd = other.gameObject.AddComponent<OverTimeDamage>();
otd.damage = this.damage;
otd.timer = this.timer;
Destroy(gameObject);
}
Like I said, the other projectile I used this code on works just fine, it triggers first, then it turns the collider to not-trigger in order for it to “truly collide”. Then, in OnCollisionEnter2D, I put the code for damage and whatnot.
Here’s what happens with this thing:
All rigidbodies are dynamic, and all of their collision detections are continuous, I really have no idea what to do.