|
Post by underhand on Jun 10, 2021 20:06:27 GMT
Hello,
I don't find any solution about to play a stretched sound when my character stretch the bow. How I can integrate it?
|
|
|
Post by manwitch on Jun 10, 2021 21:37:46 GMT
Been struggling with this myself... I got the arrow release sound by adding the add sound by state tag(or whatever its called) on the animator but I've found no way to do it for the bow when the character "pulls back" on it.
Hope you get an answer for both of us LOL
|
|
|
Post by manwitch on Jun 11, 2021 1:24:00 GMT
Also in this thread invector.proboards.com/thread/1798/bow-sounds Invector made a reply, but (in my opinion) didn't explain well enough to really help with this problem. If you get what they mean maybe you could explain it to me lol.
|
|
|
Post by underhand on Jun 12, 2021 10:08:16 GMT
Based on the post you suggested to read, I wrote the follow basic script. In the vShooterWeapon, I added, to the Event Listener OnPowerChargerChanged, the PlaySingleAudioClip and, to the OnShot, the ResetAudioClip method. I think that this solution is a wordaround... the best thing could have a specific Event Listener that is called when the bow starts to be stretched inside the vShooterWeapon.
private AudioSource audioSource;
private bool audioPlaying = false;
private bool IsPlayableSound(float value) => (audioSource &&
!audioPlaying &&
value != 0;
// Start is called before the first frame update
void Start()
{
audioSource = GetComponent<AudioSource>();
}
public void PlaySingleAudioClip(float value)
{
if (IsPlayableSound(value))
{
Debug.Log("Play");
audioSource.Play();
audioPlaying = true;
}
}
public void ResetAudioClip()
{
Debug.Log("Reset");
audioPlaying = false;
}
|
|
|
Post by skullvez on Jul 4, 2021 2:41:31 GMT
underhand manwitch Im still new to this but this is what I got so far. I havnt figured out how to get it to reset the sound after the 1st shot but on the 1st pull back it makes a sound and on the fire. I like it so far and Im sure its something small we're over looking lol I had to change/add in the events on the vBowInventory. See video. Hope this helps. 🕹️🎮💀 P.S the bow I got for FREE download on sketchfab. I thinks its from Cyrsis. IDK cuz I never played but looks dope lol
|
|
|
Post by manwitch on Jul 15, 2021 21:42:10 GMT
Yea, that is the same way I have mine set up at the moment but I don't like how it triggers right away instead of when you actually "pull back" on the bow.
I'm looking in to adding sounds to the actual animation through the animation events, I suspect that is the only way to get it to work correctly so the sound triggers with the (I use xbox controller) right trigger pull.
I found a video tutorial on adding the sounds to animations but I haven't actually tried it yet. But the video had sounds added to footsteps and seemed to be the solution, if I can find it again I'll post a link lol.
|
|
eldv
Junior vMember
Posts: 47
|
Post by eldv on Jul 25, 2021 5:57:28 GMT
You can trigger the sound using the TriggerSoundByState behavior in the animator controller.
|
|
|
Post by manwitch on Jul 25, 2021 13:09:15 GMT
You can trigger the sound using the TriggerSoundByState behavior in the animator controller. Maybe you could give us a short tutorial on how to accomplish this. I can't get the triggersound by state to go on a blend tree so this solution only gets you as far as skullvezs video. Which plays the sound on equip not when you actually pull back on the bow.
|
|