try to fix rotation

This commit is contained in:
Crispy 2021-05-17 23:18:06 +02:00
parent 0407fd297a
commit 4865f19bb6
4 changed files with 27 additions and 11 deletions

View file

@ -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/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://overlays/TimeOverlay.tscn" type="PackedScene" id=3]
[ext_resource path="res://temp.gd" type="Script" id=4] [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/zx.tscn" type="PackedScene" id=5]
[ext_resource path="res://overlays/xyz_widget/yz.tscn" type="PackedScene" id=6] [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"] [node name="Overlays" type="Node"]
script = ExtResource( 4 ) script = ExtResource( 4 )
@ -15,7 +20,8 @@ overlay_scene = ExtResource( 3 )
offset_pos = Vector3( -0.05, 0.02, 0.15 ) offset_pos = Vector3( -0.05, 0.02, 0.15 )
offset_rot = Vector3( 0, -90, -135 ) offset_rot = Vector3( 0, -90, -135 )
width_meters = 0.1 width_meters = 0.1
fallback_to_hmd = true
[node name="OverlayInteraction" parent="OverlayInstance Time" instance=ExtResource( 2 )]
[node name="XYZ Widget" type="Node" parent="."] [node name="XYZ Widget" type="Node" parent="."]
@ -33,4 +39,10 @@ offset_rot = Vector3( 90, 0, 0 )
[node name="OverlayInstance" parent="." instance=ExtResource( 1 )] [node name="OverlayInstance" parent="." instance=ExtResource( 1 )]
target = 3 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 )

View file

@ -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/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/godot-openvr/OpenVROverlay.gdns" type="Script" id=3]
[ext_resource path="res://addons/openvr_overlay/styles/normal.theme" type="Theme" id=5] [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 anchor_bottom = 1.0
theme = ExtResource( 5 ) theme = ExtResource( 5 )
[node name="Offset" type="RemoteTransform" parent="."] [node name="Offset" type="Spatial" parent="."]
remote_path = NodePath("../ARVROrigin/LeftHand/Area")
[node name="OffsetInv" type="RemoteTransform" parent="."]
use_global_coordinates = false use_global_coordinates = false
update_scale = false update_scale = false
[node name="OverlayInteraction" parent="." instance=ExtResource( 2 )]

View file

@ -22,8 +22,8 @@ func _ready() -> void:
get_parent().connect("width_changed", self, "_on_width_changed") get_parent().connect("width_changed", self, "_on_width_changed")
_on_width_changed(get_parent().width_meters) _on_width_changed(get_parent().width_meters)
get_node("../Offset").remote_path = $Offset.get_path() get_node("../OffsetInv").remote_path = $Offset.get_path()
$Offset.remote_path = "../LeftHand/Area" $Offset.remote_path = $LeftHand/Area.get_path()
func _process(delta: float) -> void: func _process(delta: float) -> void:

View file

@ -48,7 +48,13 @@ func update_tracker_id() -> void:
func update_offset() -> void: func update_offset() -> void:
$Offset.translation = offset_pos $Offset.translation = offset_pos
$OffsetInv.translation = offset_pos
$Offset.rotation_degrees = offset_rot $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) # print(_tracker_id)
match target: match target:
TARGETS.head: TARGETS.head: