Jump to content

[SOLVED] How to make Footstep Sound Effects when using the First Person Controller


photo

Recommended Posts

Hi all, 

 

I really want to achieve being able to make a footstep sound effect as the first person controller moves (I am just using the generic first person controller node included in the blank template). Is there an easy way to achieve this? I have no programming knowledge at all, so fingers crossed its not too hard to implement! 

 

Many thanks, 

 

Ben

Link to comment

Hi Ben,

Need add SoundSource for left and right footsteps:

Spoiler

image.png

Update FirstPersonController.cs from attached file. There are main changes in 792-814 lines. In edtor set new fields in first_person_controller property

Spoiler

image.png

 

FirstPersonController.cs

  • Like 3
Link to comment

Hi, 

 

Thank-you for getting back to me. I have tried the above suggestion but am having a little difficulty - if I try to import the attached code, there are some build errors and it doesnt work. Also if I copy and paste the lines from 792-814 from the attached code to the code in my first person controller, there is still an error building. 

Am I doing something wrong? 

 

Many thanks, 

 

Ben

Link to comment

Hi,

Can you show me build errors? When you import attached file need delete FirstPersonController that is already in the project, but you need copy 24 line with guid

Link to comment

Okay, so deleting the previous FirstPersonController that was already in the project and importing the attached on worked fine. No build errors. There is no need to copy those 24 lines of code right? If just using the attached controller?

I have set footstep samples for both left and right feet, when trying in runtime it seems to play the samples on loop regardless of if the controller is moving or not - so still not working quite right. The sound samples are 9 seconds, so I need to loop - I have attached some screenshots, many thanks again for your assistance and my apologies as I am an artist with no programming knowledge :D

 

image.thumb.png.4ab3d896ff925ec7189b725433fb6b76.pngimage.png.d715db28cfb97c6ef210eee7e0a94bde.png

 

Many thanks, 

 

Ben

Link to comment

Hi,

Uncheck Loop flag and check "Restart On Enable". This will start the footstep sound from the beginning each time. You may need to shorten the footstep sample

  • Like 1
Link to comment

Yes, that did it - trimmed the sample down to just one 'footstep' and checked 'restart on enable' and am happy enough for the result for now

Thank you very much for your assistance - I appreciate it! 

 

Many thanks, 

 

Ben

  • Like 2
Link to comment
  • silent changed the title to [SOLVED] How to make Footstep Sound Effects when using the First Person Controller
×
×
  • Create New...