I’m making an archery game and using the below code on my arrow prefab. This should stop and freeze the projectile on collision with any object using a particular tag, however the object stretches and warps on impact. How can I make it stop like a regular arrow?
void OnCollisionEnter(Collision col){
if(col.transform.tag == "WoodenObject"){
StartCoroutine(WoodObjectImpact(col));
}
}
IEnumerator WoodObjectImpact(Collision col){
Debug.Log("started wooden object impact");
audio.PlayOneShot(arrowimpactwood);
transform.parent = col.transform;
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
rb.constraints = RigidbodyConstraints.FreezeAll;
rb.isKinematic = true;
embedded = true;
yield return null;
}