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

Update XR Tools to commit 6d306305b89e57e32a1fe3bdf3fbddb3a06a9601 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions addons/godot-xr-tools/assets/RightHand.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
[ext_resource type="PackedScene" uid="uid://080d3mces54o" path="res://addons/godot-xr-tools/assets/LeftHand.glb" id="3"]

[node name="RightHand" type="Node3D"]
script = ExtResource("2")
script = ExtResource( "2" )

[node name="RightHand" parent="." instance=ExtResource("3")]
[node name="RightHand" parent="." instance=ExtResource( "3" )]
transform = Transform3D(0.5, 0, -4.37114e-08, 0, 0.5, 0, -4.37114e-08, 0, -0.5, 0, -0.03, 0.15)

[node name="Skeleton3D" parent="RightHand/Armature_Left" index="0"]
bones/2/rotation = Quaternion(0.253774, 0.0991975, 0.130968, 0.953208)
bones/3/rotation = Quaternion(0.0272358, -0.00745519, 0.0169876, 0.999457)
bones/5/rotation = Quaternion(0.0158641, 0.00352782, -0.0490804, 0.998663)
bones/5/rotation = Quaternion(0.0158641, 0.00352781, -0.0490804, 0.998663)
bones/6/rotation = Quaternion(0.156098, 0.00317533, 0.137669, 0.978095)
bones/7/rotation = Quaternion(0.0149969, 0.0124148, 0.102016, 0.994592)
bones/9/rotation = Quaternion(0.0821832, 0.00292176, 0.0217395, 0.996376)
bones/10/rotation = Quaternion(0.0545661, 0.000884077, 0.241461, 0.968875)
bones/10/rotation = Quaternion(0.0545661, 0.000884079, 0.241461, 0.968875)
bones/11/rotation = Quaternion(0.0347991, -0.0371998, 0.156823, 0.986312)
bones/13/rotation = Quaternion(-0.0171483, -0.00440917, -0.0360487, 0.999193)
bones/14/rotation = Quaternion(0.0443504, -0.0295383, 0.31258, 0.948396)
bones/15/rotation = Quaternion(0.0397679, -0.133869, 0.252752, 0.9574)
bones/17/rotation = Quaternion(-0.0944304, -0.00336633, 0.0820851, 0.992136)
bones/17/rotation = Quaternion(-0.0944304, -0.00336634, 0.0820851, 0.992136)
bones/18/rotation = Quaternion(-0.0151291, -0.0637052, 0.283732, 0.956666)
bones/19/rotation = Quaternion(-0.0435841, -0.103597, 0.15083, 0.98215)

[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = ExtResource("1")
tree_root = ExtResource( "1" )
anim_player = NodePath("../RightHand/AnimationPlayer")
active = true
parameters/Grip/blend_amount = 0.0
Expand Down
2 changes: 1 addition & 1 deletion addons/godot-xr-tools/effects/vignette.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@tool
#@tool
extends Node3D

@export var radius = 1.0:
Expand Down
4 changes: 4 additions & 0 deletions addons/godot-xr-tools/functions/Function_Flight_movement.gd
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ func _ready():


func _process(_delta: float):
# Do not run physics if in the editor
if Engine.is_editor_hint():
return

# Skip if disabled or the controller isn't active
if !enabled or !_controller.get_is_active():
set_flying(false)
Expand Down
10 changes: 5 additions & 5 deletions addons/godot-xr-tools/functions/Function_Teleport.gd
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ func _physics_process(delta):
break

# and just update our shader
$Teleport.get_surface_override_material(0).set_shader_param("scale_t", 1.0 / strength)
$Teleport.get_surface_override_material(0).set_shader_param("ws", ws)
$Teleport.get_surface_override_material(0).set_shader_param("length", cast_length)
$Teleport.get_surface_override_material(0).set_shader_parameter("scale_t", 1.0 / strength)
$Teleport.get_surface_override_material(0).set_shader_parameter("ws", ws)
$Teleport.get_surface_override_material(0).set_shader_parameter("length", cast_length)
if hit_something:
var color = can_teleport_color
var normal = Vector3.UP
Expand All @@ -273,13 +273,13 @@ func _physics_process(delta):
last_target_transform.origin = target_global_origin + Vector3(0.0, 0.001, 0.0)
$Target.global_transform = last_target_transform

$Teleport.get_surface_override_material(0).set_shader_param("mix_color", color)
$Teleport.get_surface_override_material(0).set_shader_parameter("mix_color", color)
$Target.get_surface_override_material(0).albedo_color = color
$Target.visible = can_teleport
else:
can_teleport = false
$Target.visible = false
$Teleport.get_surface_override_material(0).set_shader_param("mix_color", no_collision_color)
$Teleport.get_surface_override_material(0).set_shader_parameter("mix_color", no_collision_color)
elif is_teleporting:
if can_teleport:

Expand Down
3 changes: 1 addition & 2 deletions addons/godot-xr-tools/functions/Function_Teleport.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://b0ywd51y32i51"]

[ext_resource type="Script" path="res://addons/godot-xr-tools/functions/Function_Teleport.gd" id="1"]
[ext_resource type="Material" uid="uid://ceu21ibocsokq" path="res://addons/godot-xr-tools/materials/teleport.tres" id="2"]
[ext_resource type="Material" path="res://addons/godot-xr-tools/materials/teleport.tres" id="2"]
[ext_resource type="Material" path="res://addons/godot-xr-tools/materials/target.tres" id="3"]
[ext_resource type="Material" path="res://addons/godot-xr-tools/materials/capule.tres" id="4"]

Expand All @@ -14,7 +14,6 @@ size = Vector2(1, 1)

[sub_resource type="CapsuleMesh" id="3"]
radius = 0.4
height = 1.8

[sub_resource type="CapsuleShape3D" id="4"]
radius = 0.05
Expand Down
2 changes: 1 addition & 1 deletion addons/godot-xr-tools/functions/Function_pointer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func _update_y_offset():
func _update_distance():
$Laser.mesh.size.z = distance
$Laser.position.z = distance * -0.5
$RayCast.cast_to.z = -distance
$RayCast.target_position.z = -distance

@export_flags_3d_physics var collision_mask = 15:
set(new_value):
Expand Down
10 changes: 5 additions & 5 deletions addons/godot-xr-tools/functions/Function_pointer.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ radial_segments = 16
rings = 8

[node name="Function_pointer" type="Node3D"]
script = ExtResource( "2" )
script = ExtResource("2")
collision_mask = 524287

[node name="RayCast" type="RayCast3D" parent="."]
Expand All @@ -25,10 +25,10 @@ collision_mask = 524287
[node name="Laser" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, -5)
cast_shadow = 0
mesh = SubResource( "1" )
surface_material_override/0 = ExtResource( "1" )
mesh = SubResource("1")
surface_material_override/0 = ExtResource("1")

[node name="Target" type="MeshInstance3D" parent="."]
visible = false
mesh = SubResource( "2" )
surface_material_override/0 = ExtResource( "1" )
mesh = SubResource("2")
surface_material_override/0 = ExtResource("1")
32 changes: 16 additions & 16 deletions addons/godot-xr-tools/materials/highlight.tres
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
[gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://dyuaw57o8y3i"]

[sub_resource type="VisualShaderNodeColorParameter" id="1"]
parameter_name = "ColorParameter"
[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_nl6jr"]
parameter_name = "Color"

[sub_resource type="VisualShaderNodeVectorOp" id="2"]
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_8dcmn"]
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(0.5, 0.5, 0.5)]
operator = 2

[sub_resource type="VisualShaderNodeFloatConstant" id="3"]
[sub_resource type="VisualShaderNodeFloatConstant" id="VisualShaderNodeFloatConstant_2331j"]
constant = 0.1

[sub_resource type="VisualShaderNodeFresnel" id="4"]
[sub_resource type="VisualShaderNodeFresnel" id="VisualShaderNodeFresnel_tghd5"]

[sub_resource type="VisualShaderNodeVectorOp" id="5"]
[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_wy3ip"]
operator = 2

[sub_resource type="VisualShader" id="6"]
[sub_resource type="VisualShader" id="VisualShader_wb0u4"]
code = "shader_type spatial;
uniform vec4 ColorParameter : source_color;
uniform vec4 Color : source_color;



void fragment() {
// ColorParameter:2
vec4 n_out2p0 = ColorParameter;
vec4 n_out2p0 = Color;


// FloatConstant:4
Expand Down Expand Up @@ -51,19 +51,19 @@ void fragment() {
}
"
nodes/fragment/0/position = Vector2(660, 60)
nodes/fragment/2/node = SubResource("1")
nodes/fragment/2/node = SubResource("VisualShaderNodeColorParameter_nl6jr")
nodes/fragment/2/position = Vector2(40, 40)
nodes/fragment/3/node = SubResource("2")
nodes/fragment/3/node = SubResource("VisualShaderNodeVectorOp_8dcmn")
nodes/fragment/3/position = Vector2(360, 60)
nodes/fragment/4/node = SubResource("3")
nodes/fragment/4/node = SubResource("VisualShaderNodeFloatConstant_2331j")
nodes/fragment/4/position = Vector2(20, 180)
nodes/fragment/5/node = SubResource("4")
nodes/fragment/5/node = SubResource("VisualShaderNodeFresnel_tghd5")
nodes/fragment/5/position = Vector2(40, 340)
nodes/fragment/6/node = SubResource("5")
nodes/fragment/6/node = SubResource("VisualShaderNodeVectorOp_wy3ip")
nodes/fragment/6/position = Vector2(360, 220)
nodes/fragment/connections = PackedInt32Array(2, 0, 3, 0, 3, 0, 0, 0, 4, 0, 3, 1, 2, 0, 6, 0, 5, 0, 6, 1, 6, 0, 0, 5)

[resource]
render_priority = 0
shader = SubResource("6")
shader_parameter/ColorParameter = null
shader = SubResource("VisualShader_wb0u4")
shader_parameter/Color = Color(0.301961, 0.392157, 0.988235, 1)
2 changes: 1 addition & 1 deletion addons/godot-xr-tools/materials/teleport.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ uniform float scale_t = 0.2;
uniform float length = 20.0;
uniform float ws = 1.0;
uniform vec4 mix_color : source_color;
uniform sampler2D arrow_texture : hint_default_white;
uniform sampler2D arrow_texture : source_color;

void vertex() {
vec3 down = vec3(0.0, -1.0 / ws, 0.0);
Expand Down
19 changes: 9 additions & 10 deletions addons/godot-xr-tools/materials/teleport.tres
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://ceu21ibocsokq"]
[gd_resource type="ShaderMaterial" load_steps=3 format=2]

[ext_resource type="Shader" path="res://addons/godot-xr-tools/materials/teleport.gdshader" id="1"]
[ext_resource type="Texture2D" uid="uid://ddoj6c345cb0c" path="res://addons/godot-xr-tools/images/teleport_arrow.png" id="2_5os8b"]
[ext_resource path="res://addons/godot-xr-tools/materials/teleport.gdshader" type="Shader" id=1]
[ext_resource path="res://addons/godot-xr-tools/images/teleport_arrow.png" type="Texture" id=2]

[resource]
render_priority = 0
shader = ExtResource("1")
shader_parameter/arrow_texture = ExtResource("2_5os8b")
shader_parameter/length = 20.0
shader_parameter/mix_color = Color(0.0156863, 0.419608, 0.737255, 1)
shader_parameter/scale_t = 0.2
shader_parameter/ws = null
shader = ExtResource( 1 )
shader_param/scale_t = 0.2
shader_param/length = 30.0
shader_param/ws = 1.0
shader_param/mix_color = Color( 0.176471, 0.313726, 0.862745, 1 )
shader_param/arrow_texture = ExtResource( 2 )
8 changes: 4 additions & 4 deletions addons/godot-xr-tools/misc/XR_Helpers.gd
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ static func get_xr_camera(node: Node, path: NodePath = NodePath()) -> XRCamera3D

## Find the Left Hand Controller from a player node and an optional path
static func get_left_controller(node: Node, path: NodePath = NodePath()) -> XRController3D:
return _get_controller(node, "LeftHandController", 1, path)
return _get_controller(node, "LeftHandController", "left_hand", path)

## Find the Right Hand Controller from a player node and an optional path
static func get_right_controller(node: Node, path: NodePath = NodePath()) -> XRController3D:
return _get_controller(node, "RightHandController", 2, path)
return _get_controller(node, "RightHandController", "right_hand", path)

## Find a controller given some search parameters
static func _get_controller(node: Node, default_name: String, id: int, path: NodePath) -> XRController3D:
static func _get_controller(node: Node, default_name: String, tracker: String, path: NodePath) -> XRController3D:
var controller: XRController3D

# Try using the node path first
Expand All @@ -94,7 +94,7 @@ static func _get_controller(node: Node, default_name: String, id: int, path: Nod
# Search all children of the origin for the controller
for child in origin.get_children():
controller = child as XRController3D
if controller and controller.controller_id == id:
if controller and controller.tracker == tracker:
return controller

# Could not find the controller
Expand Down
1 change: 0 additions & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ import/blender/enabled=false
[rendering]

renderer/rendering_method="mobile"
renderer/rendering_method.mobile="mobile"
anti_aliasing/quality/msaa_3d=1

[xr]
Expand Down