Комментарии:
i clicked for the cute feet.
ОтветитьThis solution is very cheap, instead you should use Scriptable Objects and a Surface Manager
ОтветитьWorks in a regular scene but in VR I always get a no Receiver error.
ОтветитьI cannot see events at all in the inspector. I cannot find that option. I am not sure what I am missing.. Can someone help?
ОтветитьI was stressing about how I could implement this, and your video makes it so simple. Thank you :)
Ответитьbeautiful, stole your idea for my 2d platformer, its very similar, thanks j!
ОтветитьHow can I use Terran Director?
This video didn't describe that.
How can I do this in 2021.3.6f Version?
The interface looks different.
very useful my footstep sound good now thx
ОтветитьThank you this helped me!
ОтветитьNothing happens, I wrote everything in the script just the same yet nothing happens :(
Ответитьawesome tuts
Ответитьis there a way to do this for 2d footsteps?
ОтветитьAnimationEvent 'StepSound' on animation 'BasicMotions@Walk01 - Backwards' has no receiver! Are you missing a component?
ОтветитьAnd than see the same thing in UE4... It's 100 times easier and more professional there...
Ответитьomg thank you!!!!!!!!
ОтветитьGreat tut <3
ОтветитьOmg, thank you!! Working on an assignment and one little bit wasn't included in our tutorial, your code essentially identical gave me the one line that wasn't provided to us and I kept getting obsolete/deprecated errors on, tried updating to current but that was basically a step backwards. But now... THANK YOU THANK YOU THANK YOU!!!!
(now subscribed 😀)
This way so easy for me, thank you so much.
Ответитьit makes my FPS slow down rapidly I don't know why
ОтветитьThanks a lot!
ОтветитьHi Jason.
I have a question:
The scripts in the download are more intricate then the tutorial. That's cool.
I'm confused, even in the small script in your tutorial appears different in your inspector.
Where is the part that tells the script where your sound files are?
Thankyou so much.
Marc :)
Hmm, this seems kinda clever solution, but there does seem to be a lot of work to make it work with complex blend animations.
I just put two colliders to my feet and react to their enter events, then I can easily read the surfaces tag at the same time to switch the sound to match the ground surface.
With this the sound plays every time the feet physically leave and enter the ground
Finally a solution that works, thanks!
Ответитьhow do i use this on a first person style?
ОтветитьWorks like a charm. Thanks.
ОтветитьYou are the Man!!! :)
ОтветитьThank you so much. This is exactly what I was looking for.
ОтветитьThis is a great way of matching sounds to animation.
ОтветитьI found another solution to the issue with overlapping sounds when using blend trees which is to use the blend weights. The function that the animation event calls can take one parameter, which can be the animation event itself, so you can pass it into the step function and access the blend weights from there to get the audio to only play when it crosses a threshold.
public void Step(AnimationEvent animationEvent)
{
if(animationEvent.animatorClipInfo.weight > 0.5) {
AudioClip clip = GetRandomClip();
audioSource.PlayOneShot(clip);
}
}
Thanks! I've used events for sounds before but forgot all about them.
ОтветитьWhat should I put in Audio Source component?
Ответитьeres mi heroe hermano, mil gracias , tienes sin duda alguna un suscriptor mas
Ответитьif my character got more than 1 animation, how can i choose the animation i want to put the events in?
ОтветитьGRACIAS CAMPEON!
Ответить"No harm at all. Worst case, you lose some footstep sounds"
sound designers: :-(
My animation don't calling event every times, some steps are ignored, why?
ОтветитьThe number of times I've been coming back to your unity tutorials is ridiculous, thank you for all your help!
ОтветитьMaybe you know the answer to this, I'm using a blend tree with many animations - For turning while moving, walking, running and so on. How do I get something like this to work with a blend tree? Currently I did this only on the run animation but it doesn't play while turning or walking. If I do multiple, i end up with many sounds playing at once.
Ответитьthank you
ОтветитьFor those ho have a issue with blend animations, here is my solution: i just added a second Audio source, one for each feet (AudiosourceL and AudioSourceR), in the Script i copied the Step Function and rename it as StepL and StepR, finally in Animation Event i'm added a StepL (for left Foot) and a StepR(for right foot), and to prevent the audio to run multiple times, i just added a AudioSource.isPlaying.
something like that:
PS: have some modification to detect a tag from the Gameobject when the player is under it and is diferent from terrain texture, Wood, metal, concrete...
--------------------------------------------------------------------------------------
using UnityEngine;
public class FootSteps : MonoBehaviour
{
[SerializeField]
private AudioClip[] stoneClips;
[SerializeField]
private AudioClip[] mudClips;
[SerializeField]
private AudioClip[] grassClips;
[SerializeField]
private AudioClip[] woodClips;
private float distance = 20f;
public string floorTag;
public AudioSource audioSourceL;
public AudioSource audioSourceR;
private TerrainDetector terrainDetector;
private void Awake()
{
// audioSource1 = this.GetComponent<AudioSource>();
terrainDetector = new TerrainDetector();
}
public void Update()
{
RaycastHit hit;
Ray footstepRay = new Ray(this.transform.position, Vector3.down);
if (Physics.Raycast(footstepRay, out hit, distance))
{
if (hit.collider.tag == "Terrain")
{
floorTag = hit.collider.tag;
}
else if (hit.collider.tag == "Wood")
{
floorTag = hit.collider.tag;
}
}
}
private void StepL()
{
if (!audioSourceL.isPlaying)
{
if (floorTag == "Terrain")
{
AudioClip clip = GetRandomClip();
audioSourceL.PlayOneShot(clip);
}
else
{
AudioClip clip = GetRandomClip2();
audioSourceL.PlayOneShot(clip);
}
}
}
private void StepR()
{
if (!audioSourceR.isPlaying)
{
if (floorTag == "Terrain")
{
AudioClip clip = GetRandomClip();
audioSourceR.PlayOneShot(clip);
}
else
{
AudioClip clip = GetRandomClip2();
audioSourceR.PlayOneShot(clip);
}
}
}
private AudioClip GetRandomClip()
{
int terrainTextureIndex = terrainDetector.GetActiveTerrainTextureIdx(transform.position);
switch (terrainTextureIndex)
{
case 0:
return stoneClips[Random.Range(0, stoneClips.Length)];
case 1:
return mudClips[Random.Range(0, mudClips.Length)];
case 2:
default:
return grassClips[Random.Range(0, grassClips.Length)];
}
}
private AudioClip GetRandomClip2()
{
if (floorTag == "Wood")
{
return woodClips[Random.Range(0, stoneClips.Length)];
}
else
{
return null;
}
}
}
Wow ; thank you so much. You've discovered a very practical method. :)
ОтветитьThank you very much!!! So helpful :)
ОтветитьPlease, made a tutorial distinguishing steps zones, grass, gravel, wood, iron, water...
ОтветитьThank you very much!
It's work perfect here.
i love you
ОтветитьYou are the best! Thank you. You are so helpful all the time! Like
ОтветитьMaybe it's only me but I think you should explain that after you set each time the right step in the preview window you should click the add event button and it will set automatic the timestamp. I tried to set the timestamp each time on my own and messed it. Maybe you are explain that and I missed this part. Great tutorial it's just it took me some time to understand this timestamp part.
ОтветитьSuper helpful and clear, thanks!
Ответить