- Home /
OnCollisionEnter2d
Hi guys again, Iam trying to use OnCollisionEnter2D function:
I just want to, that if player hit Enemy he will get knockback. The first if statement is chacking just running state, it shoud be fine, even the Debug.log is working but Player just dont get any velocity... Any ideas what am I doing wrong?
There is some more screenshots:Player Rigidbody and collider
Thanks :D
Answer by mbro514 · Aug 05, 2020 at 03:07 PM
It might be that you have some code somewhere else that sets your player's velocity to something else, which would cancel the velocity changes you make in the OnCollisionEnter2D function.
Thanks for answer i found the issue. But now he is teleporting... :D Any ideas?
I'm afraid not, unless if changing the code to fix your original problem is causing this new one.