diff --git a/ovr-utils/Main.tscn b/ovr-utils/Main.tscn index 41a3d71..2e9cda2 100644 --- a/ovr-utils/Main.tscn +++ b/ovr-utils/Main.tscn @@ -1,11 +1,16 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://addons/openvr_overlay/OverlayInstance.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/openvr_overlay/interaction/OverlayInteraction.tscn" type="PackedScene" id=2] [ext_resource path="res://overlays/TimeOverlay.tscn" type="PackedScene" id=3] [ext_resource path="res://temp.gd" type="Script" id=4] [ext_resource path="res://overlays/xyz_widget/zx.tscn" type="PackedScene" id=5] [ext_resource path="res://overlays/xyz_widget/yz.tscn" type="PackedScene" id=6] +[sub_resource type="Environment" id=1] +background_mode = 1 +background_color = Color( 0.105882, 0.0862745, 0.164706, 1 ) + [node name="Overlays" type="Node"] script = ExtResource( 4 ) @@ -15,7 +20,8 @@ overlay_scene = ExtResource( 3 ) offset_pos = Vector3( -0.05, 0.02, 0.15 ) offset_rot = Vector3( 0, -90, -135 ) width_meters = 0.1 -fallback_to_hmd = true + +[node name="OverlayInteraction" parent="OverlayInstance Time" instance=ExtResource( 2 )] [node name="XYZ Widget" type="Node" parent="."] @@ -33,4 +39,10 @@ offset_rot = Vector3( 90, 0, 0 ) [node name="OverlayInstance" parent="." instance=ExtResource( 1 )] target = 3 -offset_pos = Vector3( 0.397, 0.295, -0.772 ) +offset_pos = Vector3( 0, 0, 0 ) +offset_rot = Vector3( 45, 45, 0 ) + +[node name="OverlayInteraction" parent="OverlayInstance" instance=ExtResource( 2 )] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource( 1 ) diff --git a/ovr-utils/addons/openvr_overlay/OverlayInstance.tscn b/ovr-utils/addons/openvr_overlay/OverlayInstance.tscn index 4917e46..88e6988 100644 --- a/ovr-utils/addons/openvr_overlay/OverlayInstance.tscn +++ b/ovr-utils/addons/openvr_overlay/OverlayInstance.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://addons/openvr_overlay/overlay_instance.gd" type="Script" id=1] -[ext_resource path="res://addons/openvr_overlay/interaction/OverlayInteraction.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/godot-openvr/OpenVROverlay.gdns" type="Script" id=3] [ext_resource path="res://addons/openvr_overlay/styles/normal.theme" type="Theme" id=5] @@ -26,9 +25,8 @@ anchor_right = 1.0 anchor_bottom = 1.0 theme = ExtResource( 5 ) -[node name="Offset" type="RemoteTransform" parent="."] -remote_path = NodePath("../ARVROrigin/LeftHand/Area") +[node name="Offset" type="Spatial" parent="."] + +[node name="OffsetInv" type="RemoteTransform" parent="."] use_global_coordinates = false update_scale = false - -[node name="OverlayInteraction" parent="." instance=ExtResource( 2 )] diff --git a/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd b/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd index 12a0cc3..8975b7d 100644 --- a/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd +++ b/ovr-utils/addons/openvr_overlay/interaction/overlay_interaction.gd @@ -22,8 +22,8 @@ func _ready() -> void: get_parent().connect("width_changed", self, "_on_width_changed") _on_width_changed(get_parent().width_meters) - get_node("../Offset").remote_path = $Offset.get_path() - $Offset.remote_path = "../LeftHand/Area" + get_node("../OffsetInv").remote_path = $Offset.get_path() + $Offset.remote_path = $LeftHand/Area.get_path() func _process(delta: float) -> void: diff --git a/ovr-utils/addons/openvr_overlay/overlay_instance.gd b/ovr-utils/addons/openvr_overlay/overlay_instance.gd index 6ebf731..080ee9d 100644 --- a/ovr-utils/addons/openvr_overlay/overlay_instance.gd +++ b/ovr-utils/addons/openvr_overlay/overlay_instance.gd @@ -48,7 +48,13 @@ func update_tracker_id() -> void: func update_offset() -> void: $Offset.translation = offset_pos + $OffsetInv.translation = offset_pos $Offset.rotation_degrees = offset_rot + $OffsetInv.rotation_degrees = offset_rot + $OffsetInv.rotation_degrees.x *= -1 + $OffsetInv.rotation_degrees.y *= -1 + $OffsetInv.rotation_degrees.z *= -1 + # print(_tracker_id) match target: TARGETS.head: