Javascript errors & black screen when Enter, then exit, then re-enter VR
leweaver opened this issue · comments
System
OS: Windows 10 Fall Creators Update
Browser: Edge
Headset: Windows Mixed Reality with Motion Controllers
Repo steps:
- Ensure controllers are powered on and connected
- Navigate to site, and Enter VR
- Press the Windows Key on the controller to Exit VR
- Press the Enter VR button to re-enter VR
Observed issue
JavaScript errors flood the console and nothing is rendered to the headset. I traced the javascript error to this line, which fails as pose.orientation is null:
I believe this issue appears because you are caching the gamepad object between frames; but VRController does not get a chance to emit the 'on gamepad disconnected' event, since you do not update the controls when not presenting:
Line 162 in 67caaf2
This causes the gamepad object to become stale and invalid when requestPresent is called a second time.