How to make an arrow to become stuck?


I have a bow and an arrow. I want to shoot the arrow at an enemy.

The enemy and the arrow have both a collider.
But when the arrow hits the enemy it collide with the enemy and get pushed back.

So how to become the arrow to stuck in the enemy? (If also possible to control how deep the arrow will stuck?)

Thank you

You could set the arrow rigidbody to kinematic to stop the physics movement, move the arrow a little forward to ensure it penetrated the enemy body, and make it an enemy child to join both. If you have a OnCollisionEnter function in the enemy script, you can use something like this:

var depth: float = 0.30; // how deep the arrow will enter the body

function OnCollisionEnter(col: Collision){
  if (col.transform.tag == "arrow"){ // only arrows accepted
    col.rigidbody.isKinematic = true; // stop physics control
    col.transform.Translate(depth * Vector3.forward); // move the arrow deep inside
    col.transform.parent = transform; // stuck the arrow to the enemy