The moving of the role of Unity3d--the keyboard movement in rear-end view

Source: Internet
Author: User

The so-called rear-end is only to see the role of the back, more typical of the assassin type, true three unique category.

This function is done under the Aniamtor system, and the following steps need to be prepared to complete this walking effect:
1. Drag into the idle action and blend tree,blend tree to mix left running, straight run, right run 3 action.

2. Define a float type variable speed as the toggle condition for the action: Idle->blend Tree (speed>0.1), blend tree, idle (speed<0.1)

3. Set a float type of direction,-1,0,1 for the 3 actions of the mixed tree as a left-running, straight-run, right-running threshold.

Finally, complete the following code

        if(animator) {floatH = Input.getaxis ("Horizontal"); floatv = Input.getaxis ("Vertical"); //Set Animation transition conditionsAnimator. SetFloat (" Speed", h*h+v*v); Animator. SetFloat ("Direction", H, Directiondamptime, time.deltatime); }   

The code is fairly brief and simple, and the threshold of the mixed tree corresponds exactly to the size of the horizontal axis, enabling a corresponding switch.

But here set speed when the h*h+v*v as the value of the switch I do not understand, I hope to understand the great God to teach you.

The moving of the role of Unity3d--the keyboard movement in rear-end view

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.