Example #1
0
 /// <summary>
 /// Obtiene el input del joystick si se lo usa.
 /// </summary>
 void CheckJoystickInput()
 {
     if (virtualJoystickScript.GetJoystickPosition().x != 0f)
     {
         myTrasform.Rotate(0f, -1 * virtualJoystickScript.GetJoystickPosition().x *Time.deltaTime *rotationSpeed, 0f);
     }
 }
 void CheckForZoomInput()
 {
     if (virtualJoystickScript.GetJoystickPosition().y != 0f)
     {
         float x = virtualJoystickScript.GetJoystickPosition().y;
         myTransform.position     += (x * Time.deltaTime * zoomSpeed) * myTransform.forward;
         myTransform.localPosition = new Vector3(myTransform.localPosition.x,
                                                 myTransform.localPosition.y,
                                                 Mathf.Clamp(myTransform.localPosition.z, minDistance, maxDistance));
     }
 }
Example #3
0
    /// <summary>
    /// Obtiene el input del joystick si se lo usa.
    /// </summary>
    void CheckJoystickInput()
    {
        if (virtualJoysctickScript.GetJoystickPosition() != Vector3.zero)
        {
            Vector3 direction = new Vector3(virtualJoysctickScript.GetJoystickPosition().x, virtualJoysctickScript.GetJoystickPosition().y, 0f);
            Vector3 velocidad = direction * cameraSpeed * Time.deltaTime;

            /*velocidad = myTransform.TransformDirection(velocidad);
             * velocidad.y = direction.y * cameraSpeed * Time.deltaTime;
             * myTransform.position += velocidad;*/
            offset += velocidad;
            // limitar los movimientos verticales del joystick
            offset.y = Mathf.Clamp(offset.y, 0f, 10f);
        }
    }
Example #4
0
    void CheckJoystickInput()
    {
        Vector3 direction = new Vector3(virtualJoystickScript.GetJoystickPosition().x, 0f, virtualJoystickScript.GetJoystickPosition().y);
        //Debug.DrawLine(Vector3.zero,direction);
        Vector3 velocidad = direction * speed * Time.deltaTime;

        //Debug.DrawLine(Vector3.zero, velocidad*5, Color.blue);
        velocidad = Camera.main.transform.TransformDirection(velocidad);
        //Debug.DrawLine(Camera.main.transform.position, velocidad*5,Color.red);
        myRigidbody.velocity += velocidad;
    }