Hit from kinematic rigidbody2d
In my game I have player which continuously rotating sword. Sword has collider2d and kinematic rigidbody2d (I rotating sword via script).
I also have enemy with a head (rigidbody2d and colllider2d).
What I try to achieve now is when sword hit the head, head should fly away from sword in natural physic manner. But the problem that kinematic object (sword) doesn't apply any force to head.
I tried to add some physics material with bounciness to sword and head, but I didn't get any significant result.
One idea come to my mind so far how I can achieve this result - Try to detect collision and add some force to head via script, but what farce I need to add and in which direction? Or maybe I can make sword not kinematic for some time (when hit the head) and then switch it back to kinematic?
Please advice what can be the best solution for this problem?
Thanks
Answer by FIO5700 · Sep 19, 2016 at 06:29 AM
The correct answer is [PointEffector2d][1] without IsTrigger checked on Collider2D [1]: https://docs.unity3d.com/Manual/class-PointEffector2D.html