Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
ectwc112211

mechanim

Question

Hey everyone, Its been a long time since I have messed around with this stuff so I need a little help if someone could. 

I followed this tutorial on youtube and I would like to know the best way to implement running into this script, I looked into implementing the left shift as running and when its let go to stop. 

but couldn't figure out why it wasn't working so I took it out so if someone could help that would be great. 

 

 

 

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Running mode could be implemented just using a float which is increased when you keep a shift key down  - decreased when you release your key.

There is an interesting video about it at this address with explanation ++

 

 

Share this post


Link to post
Share on other sites

  • 0
Please login or register to see this quote.

pretty sure i have not sure if that line of code is wrong or not

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

I did indeed watch this but was unsure on how to convert some of those lines to c#

Share this post


Link to post
Share on other sites
  • 0

@ectwc112211 My bad sorry, I was looking for a Vector3 as it is named velocity. I'd rather have a public float for each move speeds: walkSpeed and runSpeed, and instead of directly multiplying transform.forward with a public value you check which speed should be used. Something like this:

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...