Hi guys , heres my current script to cause objects to play a sound when hit , but i need to fix something so nether the object or the object hiting it move in anyway on the collision .
var myClip : AudioClip;
var explosionPrefab : GameObject ;
function OnCollisionEnter(collision : Collision) {
// Debug-draw all contact points and normals
for (var contact : ContactPoint in collision.contacts) {
Debug.DrawRay(contact.point, contact.normal, Color.white);
}
// Play a sound if the coliding objects had a big impact.
//if (collision.relativeVelocity.magnitude > 0)
audio.PlayOneShot(myClip);
Debug.log("ok");
}
I’ve tried deleting rig bodies, but when i do that, the sound doesn’t play when hit .