- Home /
Question by
AnishsUsername · Oct 13, 2018 at 08:51 AM ·
movementrigidbody2dphysics2dcollider2dbehaviour
Weird behaviour after Collision?
Dear experts,
I've faced an issue with my collision. The Knife-Object collides with the barrier and it should just fall and rotate a bit, but somehow the Knife does some weird behavior at the end. There is no collider at this position where the behavior stars to happen.
Here is the Video of the situation: https://streamable.com/3o7hh
Code:
void OnCollisionEnter2D(Collision2D other){
if(other.collider.tag == "Barrier"){
other.collider.gameObject.GetComponent<Barrierhandler>().gameOver();
KnifeScript.hit = true;
GetComponent<PolygonCollider2D>().enabled = false;
rigid.gravityScale = 1;
}
}
Comment