Unity 3d-easy Touch 3 Tutorial Turn

Source: Internet
Author: User

Easy Touch Tutorials

Transferred from: http://www.unitymanual.com/thread-31332-1-1.html

1.import "Easy Touch 3" Resource pack
2. Create a character model
3. Create a terrain
4. Add an instance of Joystick: Hedgehog team->easy touch->extensions->add a new Joystick. Then we can see it coming out in the lower left corner.
5. Set the relevant parameters of the joystick, see


6. Create a new script MoveController.cs to receive the joystick events and control the movement of the characters. The code is as follows:

[AppleScript] Plain Text View Copy Code?
0102030405060708091011121314151617181920212223242526272829303132333435363738394041424344454647 using UnityEngine;  using System.Collections;    public class MoveController : MonoBehaviour {      void OnEnable()    {        EasyJoystick.On_JoystickMove += OnJoystickMove;          EasyJoystick.On_JoystickMoveEnd += OnJoystickMoveEnd;      }        //移动摇杆结束       void OnJoystickMoveEnd(MovingJoystick move)    {        //停止时,角色恢复idle        if (move.joystickName == "MoveJoystick")        {            animation.CrossFade("idle")        }     }        //移动摇杆中       void OnJoystickMove(MovingJoystick move)     {        if (move.joystickName != "MoveJoystick")        {            return        }                  //获取摇杆中心偏移的坐标           float joyPositionX = move.joystickAxis.x;          float joyPositionY = move.joystickAxis.y;              if (joyPositionY != 0 || joyPositionX != 0)        {            //设置角色的朝向(朝向当前坐标+摇杆偏移量)              transform.LookAt(new Vector3(transform.position.x + joyPositionX, transform.position.y, transform.position.z + joyPositionY))            //移动玩家的位置(按朝向位置移动)               transform.Translate(Vector3.forward * Time.deltaTime * 5)            //播放奔跑动画               animation.CrossFade("run")        }    }}



Finish the work, the specific


Finally, let's take a look at the parameters of Easy touch




    • Summarize

Easy Touch offers a virtual joystick solution that can be adapted to your every need. Including the previous mentioned, custom UI, hide, specify the area and so on. You can try it out in your project

    • Source


http://pan.baidu.com/s/1ovU58

Unity 3d-easy Touch 3 Tutorial Turn

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.