generated from krampus/template-godot4
	More shot UI
This commit is contained in:
		
							parent
							
								
									9752e64ea4
								
							
						
					
					
						commit
						a469af26f4
					
				
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -51,6 +51,10 @@ config/controls/camera/x_axis_acceleration=30.0 | |||||||
| config/controls/camera/y_axis_acceleration=30.0 | config/controls/camera/y_axis_acceleration=30.0 | ||||||
| config/controls/camera/invert_pitch=false | config/controls/camera/invert_pitch=false | ||||||
| 
 | 
 | ||||||
|  | [gui] | ||||||
|  | 
 | ||||||
|  | theme/custom="res://src/ui/main_theme.tres" | ||||||
|  | 
 | ||||||
| [input] | [input] | ||||||
| 
 | 
 | ||||||
| camera_forward={ | camera_forward={ | ||||||
|  | |||||||
| @ -11,6 +11,7 @@ enum Phase { | |||||||
| const PITCH_MIN := deg_to_rad(-60.0) | const PITCH_MIN := deg_to_rad(-60.0) | ||||||
| const PITCH_MAX := deg_to_rad(-5.0) | const PITCH_MAX := deg_to_rad(-5.0) | ||||||
| const ZOOM_LENGTH := 0.1 | const ZOOM_LENGTH := 0.1 | ||||||
|  | const ZOOM_ELEVATION_RATIO := 0.3166 | ||||||
| 
 | 
 | ||||||
| const ZOOM_MIN := 1.0 | const ZOOM_MIN := 1.0 | ||||||
| const ZOOM_MAX := 12.0 | const ZOOM_MAX := 12.0 | ||||||
| @ -19,6 +20,7 @@ const ARROW_ACCELERATION := 8.0 | |||||||
| 
 | 
 | ||||||
| const FREE_CAM_RETURN_TIME := 0.618 | const FREE_CAM_RETURN_TIME := 0.618 | ||||||
| const BALL_RETURN_TIME := 0.618 | const BALL_RETURN_TIME := 0.618 | ||||||
|  | const CAMERA_SNAP_TIME := 0.3 | ||||||
| 
 | 
 | ||||||
| ## In Driving Range mode, the ball can be retrieved in the shot phase. | ## In Driving Range mode, the ball can be retrieved in the shot phase. | ||||||
| @export var driving_range := false | @export var driving_range := false | ||||||
| @ -56,8 +58,13 @@ var _free_camera: FreeCamera | |||||||
| var _returning_free_camera := false | var _returning_free_camera := false | ||||||
| 
 | 
 | ||||||
| @onready var direction: Node3D = %Direction | @onready var direction: Node3D = %Direction | ||||||
|  | @onready var elevation: Node3D = %Elevation | ||||||
| @onready var pitch: Node3D = %Pitch | @onready var pitch: Node3D = %Pitch | ||||||
|  | @onready var zoom: Node3D = %Zoom | ||||||
| @onready var camera: Camera3D = %Camera | @onready var camera: Camera3D = %Camera | ||||||
|  | @onready var tracking_camera: TrackingCamera = %TrackingCamera | ||||||
|  | 
 | ||||||
|  | @onready var shot_animation: AnimationPlayer = %ShotAnimation | ||||||
| 
 | 
 | ||||||
| @onready var arrow: Node3D = %Arrow | @onready var arrow: Node3D = %Arrow | ||||||
| @onready var arrow_animation: AnimationPlayer = %ArrowAnimation | @onready var arrow_animation: AnimationPlayer = %ArrowAnimation | ||||||
| @ -73,6 +80,8 @@ var _returning_free_camera := false | |||||||
| 
 | 
 | ||||||
| @onready var drive_ref: RayCast3D = %DriveRef | @onready var drive_ref: RayCast3D = %DriveRef | ||||||
| 
 | 
 | ||||||
|  | @onready var nice_animation: AnimationPlayer = %NiceAnimation | ||||||
|  | 
 | ||||||
| @onready var camera_distance := camera.position.z: | @onready var camera_distance := camera.position.z: | ||||||
| 	set = _set_camera_distance | 	set = _set_camera_distance | ||||||
| 
 | 
 | ||||||
| @ -83,8 +92,12 @@ var _returning_free_camera := false | |||||||
| 
 | 
 | ||||||
| func _set_camera_distance(value: float) -> void: | func _set_camera_distance(value: float) -> void: | ||||||
| 	var tween := get_tree().create_tween() | 	var tween := get_tree().create_tween() | ||||||
| 	tween.tween_property(camera, "position", Vector3(0, 0, value), ZOOM_LENGTH).set_trans( | 	tween.tween_property(zoom, "position:z", value, ZOOM_LENGTH).set_trans(Tween.TRANS_SINE) | ||||||
| 		Tween.TRANS_SINE | 	tween.set_parallel() | ||||||
|  | 	( | ||||||
|  | 		tween | ||||||
|  | 		. tween_property(elevation, "position:y", value * ZOOM_ELEVATION_RATIO, ZOOM_LENGTH) | ||||||
|  | 		. set_trans(Tween.TRANS_SINE) | ||||||
| 	) | 	) | ||||||
| 	camera_distance = value | 	camera_distance = value | ||||||
| 
 | 
 | ||||||
| @ -118,13 +131,12 @@ func take_shot() -> void: | |||||||
| 
 | 
 | ||||||
| 	physics_ball.freeze = false | 	physics_ball.freeze = false | ||||||
| 	physics_ball.apply_central_impulse(impulse.rotated(Vector3.UP, -PI / 2.0)) | 	physics_ball.apply_central_impulse(impulse.rotated(Vector3.UP, -PI / 2.0)) | ||||||
| 	#ball_ref.visible = false |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| func _on_phase_change(new_phase: Phase) -> void: | func _on_phase_change(new_phase: Phase) -> void: | ||||||
| 	match new_phase: | 	match new_phase: | ||||||
| 		Phase.AIM: | 		Phase.AIM: | ||||||
| 			print("AIM PHASE") | 			camera.make_current() | ||||||
| 			power_bar.hide() | 			power_bar.hide() | ||||||
| 			curve_bar.hide() | 			curve_bar.hide() | ||||||
| 		Phase.POWER_ADJUST: | 		Phase.POWER_ADJUST: | ||||||
| @ -138,6 +150,12 @@ func _on_phase_change(new_phase: Phase) -> void: | |||||||
| 		Phase.SHOT: | 		Phase.SHOT: | ||||||
| 			power_bar.hide() | 			power_bar.hide() | ||||||
| 			curve_bar.hide() | 			curve_bar.hide() | ||||||
|  | 
 | ||||||
|  | 			nice_animation.play("display") | ||||||
|  | 
 | ||||||
|  | 			if not driving_range: | ||||||
|  | 				shot_animation.play("shoot") | ||||||
|  | 			arrow_animation.play("hide") | ||||||
| 			take_shot() | 			take_shot() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -146,6 +164,7 @@ func insert_free_cam() -> void: | |||||||
| 	_free_camera = FreeCamera.create(camera) | 	_free_camera = FreeCamera.create(camera) | ||||||
| 	add_sibling(_free_camera) | 	add_sibling(_free_camera) | ||||||
| 	control_disabled = true | 	control_disabled = true | ||||||
|  | 	camera.current = false | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| func return_free_cam() -> void: | func return_free_cam() -> void: | ||||||
| @ -155,6 +174,7 @@ func return_free_cam() -> void: | |||||||
| 	_free_camera = null | 	_free_camera = null | ||||||
| 	control_disabled = false | 	control_disabled = false | ||||||
| 	_returning_free_camera = false | 	_returning_free_camera = false | ||||||
|  | 	camera.current = true | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| func return_ball() -> void: | func return_ball() -> void: | ||||||
| @ -173,6 +193,16 @@ func return_ball() -> void: | |||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | func start_shot_track() -> void: | ||||||
|  | 	tracking_camera.make_current() | ||||||
|  | 	tracking_camera.active = true | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | func end_shot_track() -> void: | ||||||
|  | 	camera.make_current() | ||||||
|  | 	tracking_camera.active = false | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| func _process(delta: float) -> void: | func _process(delta: float) -> void: | ||||||
| 	# Rotation | 	# Rotation | ||||||
| 	direction.rotation.y = lerp_angle( | 	direction.rotation.y = lerp_angle( | ||||||
|  | |||||||
| @ -1,8 +1,9 @@ | |||||||
| [gd_scene load_steps=15 format=3 uid="uid://cy7t2tc4y3b4"] | [gd_scene load_steps=22 format=3 uid="uid://cy7t2tc4y3b4"] | ||||||
| 
 | 
 | ||||||
| [ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"] | [ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"] | ||||||
| [ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/player/physics_ball/physics_ball.tscn" id="2_1i5j5"] | [ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/player/physics_ball/physics_ball.tscn" id="2_1i5j5"] | ||||||
| [ext_resource type="PackedScene" uid="uid://c2k88ns0h5ie1" path="res://src/ui/arrow.tscn" id="2_s70wl"] | [ext_resource type="PackedScene" uid="uid://c2k88ns0h5ie1" path="res://src/ui/arrow.tscn" id="2_s70wl"] | ||||||
|  | [ext_resource type="PackedScene" uid="uid://ceu57tasi270s" path="res://src/player/tracking_camera/tracking_camera.tscn" id="3_7jqfy"] | ||||||
| 
 | 
 | ||||||
| [sub_resource type="CapsuleMesh" id="CapsuleMesh_5uovl"] | [sub_resource type="CapsuleMesh" id="CapsuleMesh_5uovl"] | ||||||
| 
 | 
 | ||||||
| @ -97,6 +98,190 @@ _data = { | |||||||
| "show": SubResource("Animation_dku72") | "show": SubResource("Animation_dku72") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | [sub_resource type="Animation" id="Animation_oks0y"] | ||||||
|  | length = 0.001 | ||||||
|  | tracks/0/type = "value" | ||||||
|  | tracks/0/imported = false | ||||||
|  | tracks/0/enabled = true | ||||||
|  | tracks/0/path = NodePath(".:position") | ||||||
|  | tracks/0/interp = 1 | ||||||
|  | tracks/0/loop_wrap = true | ||||||
|  | tracks/0/keys = { | ||||||
|  | "times": PackedFloat32Array(0), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [Vector3(0, 0, 0)] | ||||||
|  | } | ||||||
|  | tracks/1/type = "value" | ||||||
|  | tracks/1/imported = false | ||||||
|  | tracks/1/enabled = true | ||||||
|  | tracks/1/path = NodePath(".:fov") | ||||||
|  | tracks/1/interp = 1 | ||||||
|  | tracks/1/loop_wrap = true | ||||||
|  | tracks/1/keys = { | ||||||
|  | "times": PackedFloat32Array(0), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [75.0] | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [sub_resource type="Animation" id="Animation_e65hh"] | ||||||
|  | resource_name = "shot" | ||||||
|  | length = 4.0 | ||||||
|  | step = 0.01 | ||||||
|  | tracks/0/type = "value" | ||||||
|  | tracks/0/imported = false | ||||||
|  | tracks/0/enabled = true | ||||||
|  | tracks/0/path = NodePath(".:position") | ||||||
|  | tracks/0/interp = 2 | ||||||
|  | tracks/0/loop_wrap = true | ||||||
|  | tracks/0/keys = { | ||||||
|  | "times": PackedFloat32Array(0, 0.1, 0.12, 4), | ||||||
|  | "transitions": PackedFloat32Array(0.618, 1, 1.618, 1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [Vector3(0, 0, 0), Vector3(0, 1, -3), Vector3(0, 1, -3), Vector3(0, 0, 0)] | ||||||
|  | } | ||||||
|  | tracks/1/type = "value" | ||||||
|  | tracks/1/imported = false | ||||||
|  | tracks/1/enabled = true | ||||||
|  | tracks/1/path = NodePath(".:fov") | ||||||
|  | tracks/1/interp = 2 | ||||||
|  | tracks/1/loop_wrap = true | ||||||
|  | tracks/1/keys = { | ||||||
|  | "times": PackedFloat32Array(0, 0.1, 0.12, 4), | ||||||
|  | "transitions": PackedFloat32Array(0.618, 1, 1.618, 1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [75.0, 85.0, 85.0, 75.0] | ||||||
|  | } | ||||||
|  | tracks/2/type = "method" | ||||||
|  | tracks/2/imported = false | ||||||
|  | tracks/2/enabled = true | ||||||
|  | tracks/2/path = NodePath("%Direction/..") | ||||||
|  | tracks/2/interp = 1 | ||||||
|  | tracks/2/loop_wrap = true | ||||||
|  | tracks/2/keys = { | ||||||
|  | "times": PackedFloat32Array(2), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "values": [{ | ||||||
|  | "args": [], | ||||||
|  | "method": &"start_shot_track" | ||||||
|  | }] | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AnimationLibrary" id="AnimationLibrary_u78hq"] | ||||||
|  | _data = { | ||||||
|  | "RESET": SubResource("Animation_oks0y"), | ||||||
|  | "shoot": SubResource("Animation_e65hh") | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [sub_resource type="Animation" id="Animation_cwotn"] | ||||||
|  | resource_name = "display" | ||||||
|  | length = 2.4 | ||||||
|  | step = 0.1 | ||||||
|  | tracks/0/type = "value" | ||||||
|  | tracks/0/imported = false | ||||||
|  | tracks/0/enabled = true | ||||||
|  | tracks/0/path = NodePath(".:visible") | ||||||
|  | tracks/0/interp = 1 | ||||||
|  | tracks/0/loop_wrap = true | ||||||
|  | tracks/0/keys = { | ||||||
|  | "times": PackedFloat32Array(0), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "update": 1, | ||||||
|  | "values": [true] | ||||||
|  | } | ||||||
|  | tracks/1/type = "value" | ||||||
|  | tracks/1/imported = false | ||||||
|  | tracks/1/enabled = true | ||||||
|  | tracks/1/path = NodePath(".:visible_ratio") | ||||||
|  | tracks/1/interp = 1 | ||||||
|  | tracks/1/loop_wrap = true | ||||||
|  | tracks/1/keys = { | ||||||
|  | "times": PackedFloat32Array(0, 0.2), | ||||||
|  | "transitions": PackedFloat32Array(1, 1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [0.0, 1.0] | ||||||
|  | } | ||||||
|  | tracks/2/type = "value" | ||||||
|  | tracks/2/imported = false | ||||||
|  | tracks/2/enabled = true | ||||||
|  | tracks/2/path = NodePath(".:rotation") | ||||||
|  | tracks/2/interp = 3 | ||||||
|  | tracks/2/loop_wrap = true | ||||||
|  | tracks/2/keys = { | ||||||
|  | "times": PackedFloat32Array(0, 2, 2.4), | ||||||
|  | "transitions": PackedFloat32Array(1, 1, 1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [7.31612e-10, 7.31612e-10, 0.174533] | ||||||
|  | } | ||||||
|  | tracks/3/type = "bezier" | ||||||
|  | tracks/3/imported = false | ||||||
|  | tracks/3/enabled = true | ||||||
|  | tracks/3/path = NodePath(".:anchor_top") | ||||||
|  | tracks/3/interp = 1 | ||||||
|  | tracks/3/loop_wrap = true | ||||||
|  | tracks/3/keys = { | ||||||
|  | "handle_modes": PackedInt32Array(0, 0, 0), | ||||||
|  | "points": PackedFloat32Array(0.5, -0.25, 0, 0.5, -0.0548477, 0.5, -0.4, 0.0593877, 0.233401, -0.456136, 1.25, -0.25, 0, 0.25, 0), | ||||||
|  | "times": PackedFloat32Array(0, 2, 2.4) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [sub_resource type="Animation" id="Animation_3xds6"] | ||||||
|  | length = 0.001 | ||||||
|  | tracks/0/type = "value" | ||||||
|  | tracks/0/imported = false | ||||||
|  | tracks/0/enabled = true | ||||||
|  | tracks/0/path = NodePath(".:visible") | ||||||
|  | tracks/0/interp = 1 | ||||||
|  | tracks/0/loop_wrap = true | ||||||
|  | tracks/0/keys = { | ||||||
|  | "times": PackedFloat32Array(0), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "update": 1, | ||||||
|  | "values": [false] | ||||||
|  | } | ||||||
|  | tracks/1/type = "value" | ||||||
|  | tracks/1/imported = false | ||||||
|  | tracks/1/enabled = true | ||||||
|  | tracks/1/path = NodePath(".:visible_ratio") | ||||||
|  | tracks/1/interp = 1 | ||||||
|  | tracks/1/loop_wrap = true | ||||||
|  | tracks/1/keys = { | ||||||
|  | "times": PackedFloat32Array(0), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [1.0] | ||||||
|  | } | ||||||
|  | tracks/2/type = "value" | ||||||
|  | tracks/2/imported = false | ||||||
|  | tracks/2/enabled = true | ||||||
|  | tracks/2/path = NodePath(".:rotation") | ||||||
|  | tracks/2/interp = 3 | ||||||
|  | tracks/2/loop_wrap = true | ||||||
|  | tracks/2/keys = { | ||||||
|  | "times": PackedFloat32Array(0), | ||||||
|  | "transitions": PackedFloat32Array(1), | ||||||
|  | "update": 0, | ||||||
|  | "values": [7.31612e-10] | ||||||
|  | } | ||||||
|  | tracks/3/type = "bezier" | ||||||
|  | tracks/3/imported = false | ||||||
|  | tracks/3/enabled = true | ||||||
|  | tracks/3/path = NodePath(".:anchor_top") | ||||||
|  | tracks/3/interp = 1 | ||||||
|  | tracks/3/loop_wrap = true | ||||||
|  | tracks/3/keys = { | ||||||
|  | "handle_modes": PackedInt32Array(0), | ||||||
|  | "points": PackedFloat32Array(0.5, -0.25, 0, 0.25, 0), | ||||||
|  | "times": PackedFloat32Array(0) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AnimationLibrary" id="AnimationLibrary_2a0gn"] | ||||||
|  | _data = { | ||||||
|  | "RESET": SubResource("Animation_3xds6"), | ||||||
|  | "display": SubResource("Animation_cwotn") | ||||||
|  | } | ||||||
|  | 
 | ||||||
| [sub_resource type="Animation" id="Animation_pk1s7"] | [sub_resource type="Animation" id="Animation_pk1s7"] | ||||||
| length = 0.001 | length = 0.001 | ||||||
| tracks/0/type = "bezier" | tracks/0/type = "bezier" | ||||||
| @ -170,7 +355,6 @@ _data = { | |||||||
| 
 | 
 | ||||||
| [node name="ShotSetup" type="Node3D"] | [node name="ShotSetup" type="Node3D"] | ||||||
| script = ExtResource("1_r6ei4") | script = ExtResource("1_r6ei4") | ||||||
| driving_range = true |  | ||||||
| 
 | 
 | ||||||
| [node name="BallPoint" type="Node3D" parent="."] | [node name="BallPoint" type="Node3D" parent="."] | ||||||
| unique_name_in_owner = true | unique_name_in_owner = true | ||||||
| @ -191,14 +375,6 @@ mesh = SubResource("CapsuleMesh_5uovl") | |||||||
| [node name="Direction" type="Node3D" parent="."] | [node name="Direction" type="Node3D" parent="."] | ||||||
| unique_name_in_owner = true | unique_name_in_owner = true | ||||||
| 
 | 
 | ||||||
| [node name="Pitch" type="Node3D" parent="Direction"] |  | ||||||
| unique_name_in_owner = true |  | ||||||
| transform = Transform3D(1, 0, 0, 0, 0.907777, 0.419452, 0, -0.419452, 0.907777, 0, 0, 0) |  | ||||||
| 
 |  | ||||||
| [node name="Camera" type="Camera3D" parent="Direction/Pitch"] |  | ||||||
| unique_name_in_owner = true |  | ||||||
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6) |  | ||||||
| 
 |  | ||||||
| [node name="DriveRef" type="RayCast3D" parent="Direction"] | [node name="DriveRef" type="RayCast3D" parent="Direction"] | ||||||
| unique_name_in_owner = true | unique_name_in_owner = true | ||||||
| transform = Transform3D(-1, 6.18172e-08, -6.18172e-08, 0, 0.707107, 0.707107, 8.74228e-08, 0.707107, -0.707107, 0, 0.2, 0) | transform = Transform3D(-1, 6.18172e-08, -6.18172e-08, 0, 0.707107, 0.707107, 8.74228e-08, 0.707107, -0.707107, 0, 0.2, 0) | ||||||
| @ -208,6 +384,27 @@ collision_mask = 0 | |||||||
| collide_with_bodies = false | collide_with_bodies = false | ||||||
| debug_shape_thickness = 4 | debug_shape_thickness = 4 | ||||||
| 
 | 
 | ||||||
|  | [node name="Elevation" type="Node3D" parent="Direction"] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9, 0) | ||||||
|  | 
 | ||||||
|  | [node name="Pitch" type="Node3D" parent="Direction/Elevation"] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | transform = Transform3D(1, 0, 0, 0, 0.907777, 0.419452, 0, -0.419452, 0.907777, 0, 0, 0) | ||||||
|  | 
 | ||||||
|  | [node name="Zoom" type="Node3D" parent="Direction/Elevation/Pitch"] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6) | ||||||
|  | 
 | ||||||
|  | [node name="Camera" type="Camera3D" parent="Direction/Elevation/Pitch/Zoom"] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | transform = Transform3D(1, 0, 0, 0, 1, 2.98023e-08, 0, -2.98023e-08, 1, 0, 0, 0) | ||||||
|  | current = true | ||||||
|  | 
 | ||||||
|  | [node name="TrackingCamera" parent="Direction/Elevation/Pitch/Zoom/Camera" node_paths=PackedStringArray("target") instance=ExtResource("3_7jqfy")] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | target = NodePath("../../../../../../BallPoint/PhysicsBall") | ||||||
|  | 
 | ||||||
| [node name="Arrow" type="Node3D" parent="."] | [node name="Arrow" type="Node3D" parent="."] | ||||||
| unique_name_in_owner = true | unique_name_in_owner = true | ||||||
| transform = Transform3D(0.001, 0, 0, 0, 0.000707107, 0.000707107, 0, -0.000707107, 0.000707107, 0, 0.1, 0) | transform = Transform3D(0.001, 0, 0, 0, 0.000707107, 0.000707107, 0, -0.000707107, 0.000707107, 0, 0.1, 0) | ||||||
| @ -223,6 +420,13 @@ libraries = { | |||||||
| } | } | ||||||
| autoplay = "show" | autoplay = "show" | ||||||
| 
 | 
 | ||||||
|  | [node name="ShotAnimation" type="AnimationPlayer" parent="."] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | root_node = NodePath("../Direction/Elevation/Pitch/Zoom/Camera") | ||||||
|  | libraries = { | ||||||
|  | "": SubResource("AnimationLibrary_u78hq") | ||||||
|  | } | ||||||
|  | 
 | ||||||
| [node name="ShotUI" type="Control" parent="."] | [node name="ShotUI" type="Control" parent="."] | ||||||
| layout_mode = 3 | layout_mode = 3 | ||||||
| anchors_preset = 15 | anchors_preset = 15 | ||||||
| @ -232,6 +436,46 @@ grow_horizontal = 2 | |||||||
| grow_vertical = 2 | grow_vertical = 2 | ||||||
| mouse_filter = 1 | mouse_filter = 1 | ||||||
| 
 | 
 | ||||||
|  | [node name="WoahNiceFeedback" type="RichTextLabel" parent="ShotUI"] | ||||||
|  | visible = false | ||||||
|  | custom_minimum_size = Vector2(700, 0) | ||||||
|  | layout_mode = 1 | ||||||
|  | anchors_preset = -1 | ||||||
|  | anchor_left = 0.5 | ||||||
|  | anchor_top = 0.5 | ||||||
|  | anchor_right = 0.5 | ||||||
|  | anchor_bottom = 1.25 | ||||||
|  | offset_left = -350.0 | ||||||
|  | offset_top = -195.6 | ||||||
|  | offset_right = 350.0 | ||||||
|  | offset_bottom = -63.6 | ||||||
|  | grow_horizontal = 2 | ||||||
|  | grow_vertical = 2 | ||||||
|  | theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) | ||||||
|  | theme_override_constants/shadow_offset_y = 2 | ||||||
|  | theme_override_constants/shadow_offset_x = 3 | ||||||
|  | theme_override_font_sizes/bold_italics_font_size = 96 | ||||||
|  | bbcode_enabled = true | ||||||
|  | text = "[center][wave][rainbow][i][b]WOAH NICE[/b][/i][/rainbow][/wave][/center]" | ||||||
|  | fit_content = true | ||||||
|  | autowrap_mode = 0 | ||||||
|  | visible_characters_behavior = 1 | ||||||
|  | 
 | ||||||
|  | [node name="NiceAnimation" type="AnimationPlayer" parent="ShotUI/WoahNiceFeedback"] | ||||||
|  | unique_name_in_owner = true | ||||||
|  | libraries = { | ||||||
|  | "": SubResource("AnimationLibrary_2a0gn") | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [node name="Feedback" type="Control" parent="ShotUI"] | ||||||
|  | layout_mode = 1 | ||||||
|  | anchor_left = 0.5 | ||||||
|  | anchor_top = 0.3 | ||||||
|  | anchor_right = 0.5 | ||||||
|  | anchor_bottom = 0.3 | ||||||
|  | grow_horizontal = 2 | ||||||
|  | grow_vertical = 2 | ||||||
|  | 
 | ||||||
| [node name="ShotGauges" type="Control" parent="ShotUI"] | [node name="ShotGauges" type="Control" parent="ShotUI"] | ||||||
| layout_mode = 1 | layout_mode = 1 | ||||||
| anchor_left = 0.4 | anchor_left = 0.4 | ||||||
|  | |||||||
							
								
								
									
										37
									
								
								src/player/tracking_camera/tracking_camera.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/player/tracking_camera/tracking_camera.gd
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,37 @@ | |||||||
|  | class_name TrackingCamera extends Camera3D | ||||||
|  | ## Camera that tracks a target, maintaining a distance within parameters. | ||||||
|  | 
 | ||||||
|  | const ROTATION_ACCELERATION := 2.0 | ||||||
|  | const POSITION_ACCELERATION := 4.0 | ||||||
|  | 
 | ||||||
|  | @export var target: Node3D | ||||||
|  | 
 | ||||||
|  | @export var active: bool = false | ||||||
|  | 
 | ||||||
|  | @export var min_distance := 0.5 | ||||||
|  | @export var max_distance := 3.0 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | func _physics_process(delta: float) -> void: | ||||||
|  | 	if not active: | ||||||
|  | 		return | ||||||
|  | 
 | ||||||
|  | 	# Update position | ||||||
|  | 	var relative_position := global_position - target.global_position | ||||||
|  | 	var distance := relative_position.length() | ||||||
|  | 	if distance < min_distance: | ||||||
|  | 		global_position = global_position.lerp( | ||||||
|  | 			target.global_position + relative_position.normalized() * min_distance, | ||||||
|  | 			delta * POSITION_ACCELERATION | ||||||
|  | 		) | ||||||
|  | 	elif distance > max_distance: | ||||||
|  | 		global_position = global_position.lerp( | ||||||
|  | 			target.global_position + relative_position.normalized() * max_distance, | ||||||
|  | 			delta * POSITION_ACCELERATION | ||||||
|  | 		) | ||||||
|  | 
 | ||||||
|  | 	# Update rotation | ||||||
|  | 	var target_basis := ( | ||||||
|  | 		Transform3D().looking_at(target.global_position - global_position, Vector3.UP).basis | ||||||
|  | 	) | ||||||
|  | 	global_basis = global_basis.slerp(target_basis, delta * ROTATION_ACCELERATION) | ||||||
							
								
								
									
										6
									
								
								src/player/tracking_camera/tracking_camera.tscn
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/player/tracking_camera/tracking_camera.tscn
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | [gd_scene load_steps=2 format=3 uid="uid://ceu57tasi270s"] | ||||||
|  | 
 | ||||||
|  | [ext_resource type="Script" path="res://src/player/tracking_camera/tracking_camera.gd" id="1_352mq"] | ||||||
|  | 
 | ||||||
|  | [node name="TrackingCamera" type="Camera3D"] | ||||||
|  | script = ExtResource("1_352mq") | ||||||
							
								
								
									
										15
									
								
								src/ui/main_theme.tres
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/ui/main_theme.tres
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | [gd_resource type="Theme" load_steps=2 format=3 uid="uid://diodjft5u2cck"] | ||||||
|  | 
 | ||||||
|  | [sub_resource type="SystemFont" id="SystemFont_2dr7l"] | ||||||
|  | font_names = PackedStringArray("Sans-Serif") | ||||||
|  | font_italic = true | ||||||
|  | font_weight = 800 | ||||||
|  | 
 | ||||||
|  | [resource] | ||||||
|  | ShotFeedback/base_type = &"Label" | ||||||
|  | ShotFeedback/colors/font_color = Color(0.807843, 1, 1, 1) | ||||||
|  | ShotFeedback/colors/font_shadow_color = Color(0, 0, 0, 1) | ||||||
|  | ShotFeedback/constants/shadow_offset_x = 3 | ||||||
|  | ShotFeedback/constants/shadow_offset_y = 2 | ||||||
|  | ShotFeedback/font_sizes/font_size = 96 | ||||||
|  | ShotFeedback/fonts/font = SubResource("SystemFont_2dr7l") | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user