Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing and accidentally reset OpenXRPose.gdns parameters used in the right hand mesh #235

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ func _on_FPController_initialised():

func _on_FPController_failed_initialisation():
# exit our app
get_tree().quit()
#get_tree().quit()
print("Failed VR initialization, but not quitting!!!")
14 changes: 12 additions & 2 deletions demo/addons/godot-openxr/scenes/hand_mesh.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ func set_motion_range(value):
func _update_motion_range():
# for some reason not consistantly named between the two hands..
if $HandModel.find_node("Armature001"):
$HandModel/Armature001/Skeleton.motion_range = motion_range
if "motion_range" in $HandModel/Armature001/Skeleton:
$HandModel/Armature001/Skeleton.motion_range = motion_range
else:
$HandModel/Armature/Skeleton.motion_range = motion_range
if "motion_range" in $HandModel/Armature/Skeleton:
$HandModel/Armature/Skeleton.motion_range = motion_range

func set_albedo_texture(value):
albedo_texture = value
Expand All @@ -49,6 +51,14 @@ func _ready():
else:
material = $HandModel/Armature/Skeleton/vr_glove_right_slim.mesh.surface_get_material(0)

# repair gdns parameters that may have been reset, see https://github.com/GodotVR/godot_openxr/issues/234
if "path" in $HandModel:
print("RESETTING PATH from ", $HandModel.path)
$HandModel.path = "/user/hand/right"
if "hand" in $HandModel/Armature/Skeleton:
print("RESETTING HAND from ", $HandModel/Armature/Skeleton.hand)
$HandModel/Armature/Skeleton.hand = 1

_update_motion_range()
_update_albedo_texture()
_update_normal_texture()
2 changes: 1 addition & 1 deletion demo/scenes/ControllerInfo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func _process(_delta : float):
$Container/TriggerButton/Value.pressed = controller.is_button_pressed(JOY_VR_TRIGGER)
$Container/SideButton/Value.pressed = controller.is_button_pressed(JOY_VR_GRIP)

if configuration:
if configuration and configuration.has_method("get_tracking_confidence"):
var confidence = configuration.get_tracking_confidence(controller.controller_id)
if confidence == 0:
$Container/Tracking.text = "Not tracking"
Expand Down