I have a rigidbody projectile I am instantiating and adding force to. When i shoot it at an enemy I want it to stick into them, but instead it just bounces off.
This is my code for the projectile and i have a tag added to it for the collision detection
var clone : Rigidbody;
clone = Instantiate(sawProjectile, transform.position, transform.rotation);
clone.rigidbody.AddForce(clone.transform.forward * sawSpeed
function onCollisionEnter(col: Collision){
if(col.gameObject.tag == "SAW"){
Debug.Log("hit");
col.rigidbody.isKinematic = true;//stops saw physics
col.transform.Translate(depth * Vector3.forward); //moves the saw blade deeper
col.transform.parent = transform; //sticks the saw to the enemy
Physics.IgnoreCollision(col.collider, transform.collider); //stops collider for entry
}
}
As it sits it does not seem to pick up the detection at all. They all just seem to bounce off of the other collider or sometimes on rare they will just pass through it. thanks in advance