Unity3d input. Getaxis

Source: Internet
Author: User

Input. Getaxis usage:
(Getaxis ("Mouse X"),
Getaxis ("Mouse Y"),
Getaxis ("Mouse scrollwheel"),
Getaxis ("Vertical"),
Getaxis ("Horizontal"),
Getaxis is a method that needs to be passed a parameter with a string type, with the following parameters:
One: Touch screen class
1.Mouse x Mouse is triggered as it moves along the screen x
2.Mouse y Mouse is triggered as it moves along the screen y
3.Mouse Scrollwheel triggered when the mouse scroll wheel is scrolling
Two: Keyboard Operation class
1.Vertical the upper and lower arrows above the keyboard, triggered when the up or down arrows are pressed
2.Horizontal corresponds to the left and right arrows on the keyboard, which is triggered when an arrow is pressed

As an example:

1    voidUpdate ()2     {3         //2-Get axis information4         floatINPUTX = Input.getaxis ("Horizontal");5         floatInputy = Input.getaxis ("Vertical");6 7         //3-Save motion trajectory8Movement =NewVector2 (speed.x * inputx, SPEED.Y *inputy);9}

Use W, S, A, D to move up or down, respectively.

Unity3d input. Getaxis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.