Unity3d Small white Code control object through the keyboard input movement

Source: Internet
Author: User

I use the keyboard wsad to control the movement of the object, the code is as follows:

Here's a description of my code.

The Back,forward,right,left are moved in the coordinates of the object you want to control moving.

My code is moving left and right on the z axis, moving up and down on the x-axis, supposedly, by pressing a, the object should be vector.left instead of vector.right. This is because I rotate the object around the y axis 180° when I put it, and if I press a for left, I press A to go right. So I'm going to press a right and go.

As for the numbers in the judging condition, this is achieved by moving the object you want to move to the most leftmost and leftmost data in the game field. It means not to let the object run beyond the field of view.

Unity3d Small white Code control object through the keyboard input movement

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.