HTCVive controller crashes the scene when its connected/disconnected/reconnected
Opened this issue · 6 comments
S.O. Windows 10 64 bits
openvr version 1.6.10
godot_openvr version from Aug 20 2019, commit: cf9948b
Hello,
in the latest version of the godot_openvr pluggin, if an HTCVive controller gets disconnected and then reconnected when the VR scene is running, the scene crashes, this occurs right after the "activated" signal is sent by the just reconnected controller.
What is suppose to happen:
the HTCVive controller should be able to get disconnected and reconnected without the scene crashing (for example the battery died and its the connected to a charging cable)
Note: if the HTCVive is disconnected when the scene is running and then is turned on, the first connection (hot plugging) works fine
Thanks in advance
Best regards
I think I've found the cause of this. In the move to Godot-cpp we did something wrong.
The crashing on controller disconnect is a bit of a side effect. The problem is that the OVR object isn't constructed properly by the main interface.
IF you have a controller active, and you are using the ovr_controller subscene we create a render model instance. That causes the correct initialisation of the OVR object and the interface piggy backs on it.
But if you remove those scenes as controllers deactivate, eventually the ovr object gets destroyed and at that point the game crashes.
If I'm correct putting this in your main scenes gdscript would work around the problem for now:
var ovr_render_model = null
func _ready():
# work around for crash bug in openvr
ovr_render_model = preload("res://addons/godot-openvr/OpenVRRenderModel.gdns").new()
Ok, I think I've resolved the issue, or at least the one I experienced. Turns out a bit of registration code was executed too late in the process. Had to submit this upstream so we have to wait until this gets merged:
godotengine/godot-cpp#327
Thanks so much Bastiaan, for your time and help, we managed to do some testing with the workaround code but the scene crashed as soon as the controller was disconnected. I'll be checking back when the fix is merged.
If we download the nightlys from this link after the merge, will it have the fixes?:
https://hugo.pro/projects/godot-builds/
Thanks in advance
Hi Bastiaan:
I tested the latest version of openvr extracted from:
https://github.com/BastiaanOlij/godot_openvr/tree/master/demo/addons/godot-openvr/bin/win64
(commit e903a66)
on latest version of godot nightly (Godot Engine v3.2.alpha.calinou.dd3e17588) extracted from:
https://hugo.pro/projects/godot-builds/
and Im still having the same problem that the OP with my HTC Vive Pro controllers
Console prints the following error:
drivers/unix/net_socket_posix.cpp:197
Thank you for your awesome work!
@juanfrangarro thanks for testing that. Yeah sounds like you've got all the latest parts, I really wonder what is going on, so far I haven't been able to reproduce the issue with the controllers disconnecting, that part is working fine for me but it could be either a weird timing issue or maybe something unique to the vive wands (I don't have access to an HTC Vive).
The socket error has nothing to do with VR, that is an error that happens with Godot failing to connect to the debug session so the debugger works. You get that one for normal games too.