Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Right Click Mouse not work on a remote desktop

Discussion in 'Scripting' started by Serjiok, Jul 21, 2016.

  1. Serjiok

    Serjiok

    Joined:
    Jul 21, 2016
    Posts:
    7
    Hello. I have a problem.
    My application works fine on the local machine .
    It is simple - rotate the object while holding the right mouse button .
    But if I'm connected to a remote computer on which to run my application,
    I can not rotate the object . The right button does not work. With what it can be connected?
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Does the right click work in other situations with remote desktop? Like clicking on the desktop, or you could also launch a quick game that uses right click. Which software are you using as remote desktop?
     
  3. Serjiok

    Serjiok

    Joined:
    Jul 21, 2016
    Posts:
    7
  4. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Ok, seriously, why remote desktop? Why do you need that? Your problem is, that Input.GetAxis detects your mouse movement, while TeamViewer, RDP etc. won't send your computer these information, they will set your cursor postion and trigger click events
     
  5. Serjiok

    Serjiok

    Joined:
    Jul 21, 2016
    Posts:
    7
    Quite simply I often work remotely. And expect that users will also do so remotely.
    Can you show an example of the code to do this ?
     
    JasonCG likes this.
  6. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    WHY??? What kind of software are you making exactly?
    Show what? I didn't suggest any solution. You would need a "store mouselocation on mouseclick > check if changed > change will be mouseDelta > do something with mouseDelta > update mouselocation"
     
  7. Serjiok

    Serjiok

    Joined:
    Jul 21, 2016
    Posts:
    7
    Like I said, easy viewing of objects. Thanks for the tip .
     
  8. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    But still, why do you need remote desktop for that?
     
  9. Serjiok

    Serjiok

    Joined:
    Jul 21, 2016
    Posts:
    7
    It is not my desire , it is a requirement of the customer
     
    capgunmatt likes this.
  10. rich2020

    rich2020

    Joined:
    Aug 31, 2013
    Posts:
    26
    I have a similar problem in that Input.GetAxis("Mouse X") returns zero. A lot of people use virtual machines to develop on or work remotely. I'm not sure why you are asking "WHY???", gorbit99. It is a completely irrelevant question. Clearly there is an issue, so if you cannot help, keep quiet. If anyone finds a solution to this, which still exists and is discussed in other threads, then please do post a solution. I am using Windows Remote Desktop and it is not working. I've tried using Parallels (Mac VM software), too, but the issue is the same...
     
  11. Serjiok

    Serjiok

    Joined:
    Jul 21, 2016
    Posts:
    7
    My decision is that something like this:

    Vector2 lastAxis;
    void Update ()
    {
    if (Input.GetMouseButtonDown(1))
    lastAxis = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
    ...
    }
    void LateUpdate()
    {
    if (Target && Input.GetMouseButton(1))
    {
    Vector3 axis = new Vector3(-(lastAxis.x - Input.mousePosition.x) * 0.1f, -(lastAxis.y - Input.mousePosition.y) * 0.1f, Input.GetAxis("Mouse ScrollWheel"));
    lastAxis = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
    x += axis.x * xSpeed * 0.02f;
    y -= axis.y * ySpeed * 0.02f;
    //y = ClampAngle(y, yMinLimit, yMaxLimit);
    transform.rotation = Quaternion.Euler(y, x, 0);
    }
    ...
    }
     
    FlavioIT likes this.
  12. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    https://forum.unity3d.com/threads/using-code-tags-properly.143875/