highlight selected overlays when in grab mode

This commit is contained in:
Crispy 2021-05-29 23:31:05 +02:00
parent b4df1ff599
commit 78c6fd76c1
2 changed files with 19 additions and 2 deletions

View file

@ -1,8 +1,16 @@
[gd_scene load_steps=3 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/godot-openvr/OpenVROverlay.gdns" type="Script" id=3]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 1, 1, 0.231373 )
border_width_left = 24
border_width_top = 24
border_width_right = 24
border_width_bottom = 24
border_color = Color( 0, 0.784314, 1, 0.611765 )
[node name="OverlayInstance" type="Spatial"]
script = ExtResource( 1 )
@ -22,3 +30,10 @@ overlay_width_in_meters = 0.4
[node name="Container" type="Control" parent="OverlayViewport"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Selected" type="Panel" parent="OverlayViewport"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
custom_styles/panel = SubResource( 1 )

View file

@ -56,6 +56,7 @@ func _on_OverlayArea_entered(body: Node) -> void:
return
touch_state = true
active_controller = body.get_parent().name
get_parent().get_node("OverlayViewport/Selected").visible = Settings.s.grab_mode
emit_signal("touch_on")
@ -65,13 +66,14 @@ func _on_OverlayArea_exited(body: Node) -> void:
# TODO revert to other controller if both were touching (edge case)
active_controller = ""
touch_state = false
get_parent().get_node("OverlayViewport/Selected").visible = false
emit_signal("touch_off")
func _update_width():
var ratio = OverlayInit.ovr_interface.get_render_targetsize()
var extents = get_parent().width_meters * 0.5
_overlay_area.get_child(0).shape.set_extents(Vector3(extents, extents * ratio.y/ratio.x, 0.1))
_overlay_area.get_child(0).shape.set_extents(Vector3(extents, extents * ratio.y/ratio.x, 0.05))
func _update_offset():