From 5b55d3ce8128de1e78990e016a706afa4458228a Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Thu, 20 May 2021 21:05:54 +0200 Subject: [PATCH] grab translation works when attached to rotated controller --- ovr-utils/Main.tscn | 2 +- .../openvr_overlay/interaction/overlay_interaction.gd | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ovr-utils/Main.tscn b/ovr-utils/Main.tscn index d346e82..85aa8e3 100644 --- a/ovr-utils/Main.tscn +++ b/ovr-utils/Main.tscn @@ -28,7 +28,7 @@ overlay_scene = ExtResource( 7 ) [node name="OverlayInstance UI demo" parent="." instance=ExtResource( 1 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.25 ) -target = 3 +target = 1 overlay_scene = ExtResource( 5 ) [node name="OverlayInteraction" parent="OverlayInstance UI demo" instance=ExtResource( 8 )] diff --git a/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd b/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd index 87dbbea..43284b8 100644 --- a/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd +++ b/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd @@ -41,11 +41,10 @@ func _ready() -> void: func _process(_delta: float) -> void: _update_cursor() if is_moving: -# var controller_new = _overlay_area.global_transform.inverse() * _active_controller.global_transform -# var controller_delta = move_grab_offset.inverse() * controller_new -# get_parent().transform = move_start_offset * controller_delta + var oc:Transform=_overlay_area.get_parent().transform # controller that overlay is attached to var global_target = move_grab_pos + _active_controller.translation - get_parent().translation = global_target - _overlay_area.get_parent().translation + global_target = oc.xform_inv(global_target) + get_parent().translation = global_target# - _overlay_area.get_parent().translation func begin_move():