Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by inglipX · Feb 23, 2013 at 08:52 PM · audiofootsteps

help with footsteps!

I am trying make a footstep sounds when i walk in my First Person Controller. I also would like the footsteps to go faster when i sprint and slower when i crouch. Please help. I'm no coder :(

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Gikerowski · Feb 23, 2013 at 10:04 PM

Did you try this? : http://answers.unity3d.com/questions/404942/footsteps-sounds.html ?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Coreyf716 · Feb 23, 2013 at 10:18 PM

 public AudioClip walkAudio;
 public float audioTimer;
 
 void Update() {
      /* This basically asks, "is the timer greater than zero?". If the statement returns true, the timer will begin to decrease in time. You need this to hold a pattern between steps. If you use 'audio.PlayOneShot()' alone, it won't sound right.*/
      if (audioTimer > 0)
           audioTimer -= Time.deltaTime;
 
      /* This is asking, "is the timer less than or equal to zero (when subtracting by time, Unity will almost never land directly on zero), and is the vertical or horizontal axis greater than zero (these are measured in floats, numbers with a decimal). They must be put in brackets as you'll have issues with an 'and' and 'or' statement together. If all are returned true, the sound will play and the timer will be set to the length of the AudioClip*/
      if (audioTimer <= 0 && (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0))
      {
           audio.PlayOneShot(walkAudio);
           audioTimer = walkAudio.length;
      }
     /* Now, to change the gap between steps, you change the value of the timer. Ex: sprinting - audioTimer = walkAudio.length * 2;*/
 }

If you have any questions, feel free to ask.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Random footsteps 5 Answers

Footstep Sound Error toSample > fromSample 1 Answer

Footstep sounds when walking 7 Answers

What's the easiest way of changing footsteps sound depending on floor material? 3 Answers

Strange Bug or Code Error with footsteps? -1 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges