diff --git a/assets/3dmodelscc0/models/scenes/scope_display.gd b/assets/3dmodelscc0/models/scenes/scope_display.gd index 30d0658a..a1b467dc 100644 --- a/assets/3dmodelscc0/models/scenes/scope_display.gd +++ b/assets/3dmodelscc0/models/scenes/scope_display.gd @@ -1,14 +1,29 @@ @tool extends Node3D + @export var player_camera : Camera3D + +@export_range(1.0, 10.0, 0.1) var fov : float = 10.0: + set(value): + fov = value + if is_inside_tree(): + _update_fov() + @export_range(0.005, 1.000, 0.005) var radius : float = 0.025: set(value): radius = value if is_inside_tree(): _update_radius() +@export_range(0.001, 0.500, 0.001) var offset : float = 0.35: + set(value): + offset = value + if is_inside_tree(): + _update_offset() + + func _update_radius(): var mesh : QuadMesh = $DisplayMesh.mesh if mesh: @@ -19,11 +34,6 @@ func _update_radius(): if material: material.set_shader_parameter("radius", radius) -@export_range(0.001, 0.500, 0.001) var offset : float = 0.35: - set(value): - offset = value - if is_inside_tree(): - _update_offset() func _update_offset(): $ScopeAnchor.position.z = -offset @@ -35,11 +45,6 @@ func _update_offset(): if material: material.set_shader_parameter("depth", offset) -@export_range(1.0, 10.0, 0.1) var fov : float = 10.0: - set(value): - fov = value - if is_inside_tree(): - _update_fov() func _update_fov(): $SubViewport/Camera3D.fov = fov diff --git a/assets/3dmodelscc0/models/sniper_rifle/firearm_trigger.gd b/assets/3dmodelscc0/models/sniper_rifle/firearm_trigger.gd index 9460ee62..76851b7f 100644 --- a/assets/3dmodelscc0/models/sniper_rifle/firearm_trigger.gd +++ b/assets/3dmodelscc0/models/sniper_rifle/firearm_trigger.gd @@ -8,12 +8,12 @@ extends Node @export var handle_grabpoints : Array[XRToolsGrabPoint] -@onready var _parent : XRToolsPickable = get_parent() +var triggered : bool = false # Current controller holding this object var _current_controller : XRController3D -var triggered : bool = false +@onready var _parent : XRToolsPickable = get_parent() # Add support for is_xr_class on XRTools classes @@ -30,6 +30,7 @@ func _ready() -> void: for handle_grabpoint in handle_grabpoints: handle_grabpoint.enabled = false + func _physics_process(_delta): if is_instance_valid(_parent): # toggle handle grabpoints if parent got grabbed/released diff --git a/assets/meshes/control_pad/control_pad_display.gd b/assets/meshes/control_pad/control_pad_display.gd index 8ae74b72..db32af5c 100644 --- a/assets/meshes/control_pad/control_pad_display.gd +++ b/assets/meshes/control_pad/control_pad_display.gd @@ -41,7 +41,7 @@ func _on_body_scale_slider_value_changed(value : float) -> void: # Kill any current tween if _tween: _tween.kill() - + # Tween the world scale over the next 1/2 second _tween = get_tree().create_tween() _tween.tween_method( diff --git a/assets/meshes/teleport/teleport.gd b/assets/meshes/teleport/teleport.gd index 00396ec3..c3333c2a 100644 --- a/assets/meshes/teleport/teleport.gd +++ b/assets/meshes/teleport/teleport.gd @@ -201,9 +201,10 @@ func _set_inactive_beam_visible(value): func _update_teleport(): + var mat = $teleport/Cylinder.get_surface_override_material(0) if active: - $teleport/Cylinder.get_surface_override_material(0).set_shader_parameter("beam_color", active_beam_color) + mat.set_shader_parameter("beam_color", active_beam_color) $teleport/Cylinder.visible = true else: - $teleport/Cylinder.get_surface_override_material(0).set_shader_parameter("beam_color", inactive_beam_color) + mat.set_shader_parameter("beam_color", inactive_beam_color) $teleport/Cylinder.visible = inactive_beam_visible diff --git a/scenes/audio_demo/objects/arcade_hoops_ctrl.gd b/scenes/audio_demo/objects/arcade_hoops_ctrl.gd index c70f6680..23656aaf 100644 --- a/scenes/audio_demo/objects/arcade_hoops_ctrl.gd +++ b/scenes/audio_demo/objects/arcade_hoops_ctrl.gd @@ -1,6 +1,10 @@ extends Node3D +## Signal indicating a target has been passed through +signal target_passed() +signal count_down(number) + ## Optional audio stream to play when the player jumps on this surface @export var start_sound : AudioStream @@ -20,9 +24,20 @@ extends Node3D @export var start_text : String = "" @export var game_over_text : String = "" @export var scored_text : String= "" + +var ejected_token = preload ("res://scenes/audio_demo/objects/token.tscn") +var score +var tween +var _count + +# Flag indicating when ball is inside the area +var _ball_inside := false + +# Flag indicating if timer is running +var _running := false + ## Audio streams to play when the player walks on this surface @onready var player := $AudioStreamPlayer3D - @onready var score_label := $Score_Text @onready var timer := $Timer @onready var timer_label := $Timer_Text @@ -31,19 +46,8 @@ extends Node3D @onready var info_label := $Start_Text @onready var zone : XRToolsSnapZone = $SnapZone @onready var holder : Node3D = $TokenHolder -var ejected_token = preload ("res://scenes/audio_demo/objects/token.tscn") -var _count -var score -var tween -# Flag indicating when ball is inside the area -var _ball_inside := false -# Flag indicating if timer is running -var _running := false -## Signal indicating a target has been passed through -signal target_passed() -signal count_down(number) @@ -59,7 +63,7 @@ func _ready() -> void: zone.has_picked_up.connect(_on_token_insert) -func _process(delta): +func _process(_delta): if !_running: zone.enabled = true else: @@ -93,11 +97,10 @@ func _on_token_insert(_what : Node3D) -> void: zone.enabled = false tween = get_tree().create_tween() tween.tween_callback(_what.queue_free).set_delay(0.15) - tween.kill func _on_token_eject(_button) -> void: - var token_to_eject = ejected_token.instantiate() + var token_to_eject = ejected_token.instantiate() if token > 0: holder.add_child(token_to_eject) token -= 1