Example #1
0
 // Update is called once per frame
 void Update()
 {
     //if (Input.touchCount > 0 )
     //{
     //    transform.position = Input.GetTouch(0).position;
     //}
     touchHandler.detectRegion();
     transform.position = touchHandler.joyposition();
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        // getDirection();
        touchHandler.detectRegion();
        Vector3 dir = Vector3.zero;

        dir.x = touchHandler.horizontal();
        dir.z = touchHandler.vertical();
        if (dir.magnitude > 1)
        {
            dir.Normalize();
        }
        rbody.AddForce(dir * movementSpeed);
        // rbody.AddForce(new Vector3(5.0f,0.0f,0.0f));
    }