Unity-Technologies / UnityRenderStreaming

Streaming server for Unity
Other
1.31k stars 365 forks source link

[BUG]: screen position out of view frustum (screen pos 0.000000, -nan) #929

Open gawinwong opened 1 year ago

gawinwong commented 1 year ago

Package version

3.1.0-exp.6

Environment

* OS: Ubuntu 18.04
* Unity version: 2020.3.3f1
* Graphics API: vulkan
* Browser: chrome 115.0.5790.102

Steps To Reproduce

  1. Use broadcast sample, start webapp
  2. Sometime unity editor will occur this error message"screen position out of view frustum (screen pos 0.000000, -nan)"

Current Behavior

No response

Expected Behavior

No response

Anything else?

After debug, I have found that this error is caused by the below code.

# Runtime/Scripts/InputPositionCorrector.cs
unsafe void PointerMap(StateEvent* data, InputDevice device)
        {
            switch (device)
            {
                case Mouse mouse:
                    MouseState* mouseState = (MouseState*)data->state;
                    mouseState->position = Map(mouseState->position, inputRegion, outputRegion);
                    break;
                case Touchscreen touch:
                    // todo(kazuki): multi touch is not supported yet.
                    TouchState* touchState = (TouchState*)data->state;
                    touchState->position = Map(touchState->position, inputRegion, outputRegion);
                    break;
            }
        }

The mouseState->position sometime will be (0, NAN)

Hope to fix in newer version, thanks

karasusan commented 1 year ago

@gawinwong Thank you, let me check.

AlexKaravaev commented 2 months ago

Can this issue be somehow worked around?

I presume that in my case that happens because I run the executable on headless host with virtual display and mouse position there is in a weird initial position.

This is how I launch the player:

Xvfb :66 -screen 0 1024x768x24:32 +extension GLX +render -noreset &
DISPLAY=:66 vglrun exec.x86_64 --force-glcore