Hey there, I updated Unity and recognized that many things aren't working or the bahaviour changed: Code (CSharp): void OnCollisionEnter2D(Collision2D collision){ if (collision.relativeVelocity.sqrMagnitude > 50.0f) { if(PlayerPrefs.GetInt("SoundAnAus")==1){ AudioSource.PlayClipAtPoint(audioHit, transform.position); } } if (collision.collider.tag != "Damager") { return; } else if (collision.relativeVelocity.sqrMagnitude < damageImpactSpeedSqr && collision.gameObject.name!="Bombe") { return; } else{ //-> grosse Kraft if (collision.relativeVelocity.sqrMagnitude>500.0f) { currentHitPoints-=12; } //Wenn Object direkt auf Stein trifft -> grosse Kraft else if (collision.relativeVelocity.sqrMagnitude>200.0f) { currentHitPoints-=6; } //Wenn Object direkt auf Stein trifft -> grosse Kraft else if (collision.relativeVelocity.sqrMagnitude>100.0f) { currentHitPoints-=4; } currentHitPoints--; if(currentHitPoints>=6&¤tHitPoints<10){ spriteRenderer.sprite = damagedSprite1; } else if(currentHitPoints<6){ spriteRenderer.sprite = damagedSprite2; } if (collision.gameObject.name=="Bombe") { Kill (); } else if (currentHitPoints <= 0) { Kill(); } } } So I updated Unity from Version 5.2 to 5.3.3 and now the sqrMagnitude has much lower values... I also found out that the OnCollisionEnter2D isn't triggered always so there must be something wrong. Already tested setting the rigidbodies of the target and projectile which is shooted onto the target to Collision Detection = continous and Interpolate but didn't help... Is this intended or a Bug?
sqrMagnitude is a function of Vector2 so no, it's not changed or broken. relativeVelocity might have changed though, but you'd need to check. @MelvMay would probably offer more info if he's around.
Perhaps the relativeVelocity also hasn't changed but I can remember that there was an issue with the collision detection before. So perhaps this issue is back again?
Ok just found another thread in which this is discussed: http://forum.unity3d.com/threads/oncollisionenter2d-ontriggerenter2d-on-5-3-not-working.372712/
There was a bug reported regarding relativeVelocity not always reporting correctly (for some reason) so it would seem like this is the problem you're experiencing. This is one of the bugs scheduled to be looked at next week.
It would be really useful if you could create a stripped-down reproduction of the problem rather than a huge project. It makes finding the issue much easier otherwise it can be very difficult it debug the issue with so much going on.
@MelvMay Thanks for your reply. Have you already tried the submitted project or should I create a stripped down version?