|
hello i have this script
that i am using to trigger sound from a touch i just dont know what to write in the boolean condition of the ray for the system to understand to start the OnColliderEnter function i am doing it because if i playoneshot inside my ray condition it will trigger as long as i have my finger over the mesh i want to be able to trig on enter , like this i touch and it will play , but it will also play if i drag my finger over the other mesh on the screen thks
(comments are locked)
|
|
OnCollisionEnter is for rigidbodies or colliders entering the trigger, not for raycasts. If you want your sound to only play once, you just need some simple logic to check to see what's going on. Something like this: thanks for the quick answer i understand the code i tried it , it is working , but still the sound is looping , so i changed from audio clip to audio source (because i will try to work on the pitch later) i added a !snd.isPlaying condition in the loop then my problem is that the program wait for almost 3 or 4 seconds before it is possible to start the sound again because i have samples with a long reverb on . so i am back to the beginning , i know i cant use the isPlaying boolean funtion i need something like a onEnter collision usable with raycast system , and i have no idea how to do
Jul 07 '10 at 10:29 PM
Line
because the update fonction is a loop , the condition is going into a loop on everyframe once it plays , once it can t , ... i have tryed the iPhoneTouchPhase.Began but then i can t drag my finger like i would play strings of a guitar software.
Jul 07 '10 at 10:38 PM
Line
(comments are locked)
|
