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 Maulkye · Aug 06, 2010 at 12:26 AM · keypressqueue

Key Press Queuing

I've noticed when I use C# code to move a game object in response to a keypress, that holding the key down for a few seconds nonstop causes the object to continue moving for a moment after I release the key.

Alternatively, if I just jab the keys quickly, the object starts and stops instantly.

Is this some kind of key queuing and can it be disabled?

Here's the basic code I used to do the move (Spuddie is just a sphere with "arms" along it's axes):

public class SpuddieMover : MonoBehaviour { public GameObject Spuddie;

 private void Update()
 {
     float z = Input.GetAxis("Vertical");
     if ( z > 0)
         Spuddie.transform.Translate(Spuddie.transform.up * Time.deltaTime);
     else if (z < 0)
         Spuddie.transform.Translate(Spuddie.transform.up * Time.deltaTime * -1);
 }

}

Thanks in advance for any help! :)

Comment
Add comment · Show 1
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 KarlKarl2000 · Mar 18, 2016 at 10:04 AM 0
Share

Nice insight! I tried this, but I still get queued actions too.

I have my player shooting his gun.. if I press the shoot button quickly in sequence. The gun will shoot and wait for the animation to finish, then shoot again. This is well past 1 second of letting go of the key.

Any other suggestions would be greatly appreciated @ $$anonymous$$aulkye

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Eric5h5 · Aug 06, 2010 at 12:32 AM

Go to the input manager and change the gravity and sensitivity for the axis as desired.

Comment
Add comment · Show 3 · 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 Maulkye · Aug 06, 2010 at 12:39 AM 0
Share

I tried setting both to 0, but it seems to have no effect. :(

Note that my sphere is not a rigid body, so I wouldn't think gravity would have any effect... would it?

Also, isn't sensitivity was just for joysticks, mice, or other devices with ranged input?

Thanks

avatar image Eric5h5 · Aug 06, 2010 at 01:10 AM 0
Share

@$$anonymous$$aulkye, gravity in the input manager settings has nothing to do with rigidbodies, it's about the input settings. And no, sensitivity is not just for mice, it's for keyboards. http://unity3d.com/support/documentation/Components/class-Input$$anonymous$$anager.html

avatar image Maulkye · Aug 06, 2010 at 02:15 AM 0
Share

Ah thanks, I see it now. $$anonymous$$uch appreciation for your patience.

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

1 Person is following this question.

avatar image

Related Questions

While Button Pressed 3 Answers

How do I rotate an object at a constant rate a specific angle on key down? 3 Answers

How to create a collider-trigger that will start an animation when you press E 0 Answers

Multiple keypresses at once aren't regitered? 1 Answer

Implementing collision and key pressing at once 1 Answer


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