|
I have an gameobject that has a box collider and an audio source. It also has a Javascript that has a single function:
} The audio is not played when a collision happens. What is the problem?
(comments are locked)
|
|
The code looks fine. Make sure that
See the collision action matrix at the bottom of this page to see what messages are sent in different circumstances. You can further debug this issue using a print("Collision Detected"); just before audio.Play();
you don't need a rigidbody to make that function work. it says collider/rigidbody so a normal preset collider or a rigidbody.
Dec 09 '10 at 10:10 PM
Jesus_Freak
You're not going to get OnCollisionEnter with two colliders without either one of the two objects having a rigidbody. Try it. I did. You must have misunderstood.
Dec 09 '10 at 10:48 PM
Statement ♦♦
(comments are locked)
|
|
all you have to do is
make that adjustment, and replace it into your OnCollisionEnter function. really simple. hope this helps!
(comments are locked)
|
