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
2
Question by Kourosh · Nov 21, 2010 at 11:00 AM · inputrotategetaxisverticalhorizontal

How to have vertical and horizontal axis work at the same time

Ok,What i'm trying to do is to rotate an object in Roll(left/right) and Pitch(forward/back) axises like this:

function Update(){
    var horizontalRotation = Input.GetAxis("Horizontal") * rotationSpeed;
    var verticalRotation= Input.GetAxis("Vertical") * rotationSpeed;
    var rotationVector = Vector3(verticalRotation,0,-horizontalRotation);
    transform.Rotate(rotationVector * 0.1);
}

what happens is that, when for example the up arrow is pressed first, the left or right arrow does not make any change to the rotation anymore. Basically it only gets the first pressed button and ignores whatever comes after until the first button is released. how to fix this? thanks,

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

1 Reply

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

Answer by Mike 3 · Nov 21, 2010 at 03:23 PM

Works fine for me.

Is it possible you have a pretty old or dirt cheap keyboard? What could be happening is that your keyboard may be overloading the signals for the two keys, which was a common practice with older keyboards. Try pressing W and the left cursor at the same time for example instead of up and left, see if it rotates in both directions. If it does, it could well be your keyboard

Comment
Add comment · Show 1 · 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 Kourosh · Nov 22, 2010 at 08:40 AM 0
Share

Yep, I was terribly wrong! the problem was from the rest of the code. I was trying to put some angle limitations for Roll and $$anonymous$$ch which were not functioning correctly. But thanks, you assured me that the problem rested somewhere else!

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

No one has followed this question yet.

Related Questions

Horizontal as a NGUI button 0 Answers

changing a float number by moving arrows (horizontal and vertical input)? 1 Answer

PS4 Left Analog Vertical Not Working (Input.GetAxis("Vertical")) 1 Answer

Input.GetAxis(Horizontal) problem 6 Answers

AddForce on GetAxis always sam direction? 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