Scroll Zoom, First Demo Video
This commit is contained in:
parent
498dbf5ef5
commit
4237aaa589
9 changed files with 39 additions and 5 deletions
|
|
@ -12,8 +12,6 @@ func _physics_process(delta: float) -> void:
|
||||||
|
|
||||||
if target:
|
if target:
|
||||||
var direction = (target.global_transform.origin - global_transform.origin)
|
var direction = (target.global_transform.origin - global_transform.origin)
|
||||||
# looking at target
|
|
||||||
print(wp_index," ", direction.length())
|
|
||||||
|
|
||||||
var target_dir = (target.position - global_transform.origin).normalized()
|
var target_dir = (target.position - global_transform.origin).normalized()
|
||||||
var current_dir = global_transform.basis.z.normalized()
|
var current_dir = global_transform.basis.z.normalized()
|
||||||
|
|
@ -29,4 +27,3 @@ func _physics_process(delta: float) -> void:
|
||||||
if wp_index==len(waypoints):
|
if wp_index==len(waypoints):
|
||||||
wp_index=0
|
wp_index=0
|
||||||
target = waypoints[wp_index]
|
target = waypoints[wp_index]
|
||||||
print(wp_index)
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,26 @@
|
||||||
extends Camera3D
|
extends Camera3D
|
||||||
@onready var skater = $"../.."
|
@onready var skater = $"../CharacterBody3D"
|
||||||
|
|
||||||
|
var zoom:Vector2
|
||||||
|
var zoom_factor=1.0
|
||||||
|
var min_zoom=0.1
|
||||||
|
var max_zoom=10.0
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
var target_position = skater.global_transform.origin
|
var target_position = skater.global_transform.origin
|
||||||
look_at(target_position, Vector3.UP)
|
look_at(target_position, Vector3.UP)
|
||||||
|
|
||||||
|
func _unhandled_input(event):
|
||||||
|
if event.is_action_pressed("zoom_in"):
|
||||||
|
#print("Zoom In")
|
||||||
|
%Camera3D.fov -= zoom_factor
|
||||||
|
|
||||||
|
|
||||||
|
elif event.is_action_pressed("zoom_out"):
|
||||||
|
|
||||||
|
%Camera3D.fov += zoom_factor
|
||||||
|
#print("Zoom Out")
|
||||||
|
#zoom = Vector2(
|
||||||
|
# clamp(zoom.x + zoom_factor, min_zoom, max_zoom),
|
||||||
|
# clamp(zoom.y + zoom_factor, min_zoom, max_zoom)
|
||||||
|
#)
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,16 @@ config/icon="res://icon.svg"
|
||||||
[editor_plugins]
|
[editor_plugins]
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/script-ide/plugin.cfg")
|
enabled=PackedStringArray("res://addons/script-ide/plugin.cfg")
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
zoom_in={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
zoom_out={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=12 format=3 uid="uid://cd1ulyybmuft5"]
|
[gd_scene load_steps=13 format=3 uid="uid://cd1ulyybmuft5"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d2f4ue6f2152o" path="res://assets/images/checkboard.png" id="1_aj6nb"]
|
[ext_resource type="Texture2D" uid="uid://d2f4ue6f2152o" path="res://assets/images/checkboard.png" id="1_aj6nb"]
|
||||||
[ext_resource type="Script" uid="uid://deq4wi2r1o4e4" path="res://avatar.gd" id="2_28a8u"]
|
[ext_resource type="Script" uid="uid://deq4wi2r1o4e4" path="res://avatar.gd" id="2_28a8u"]
|
||||||
|
[ext_resource type="Script" uid="uid://cbufos2esa5yu" path="res://camera_3d.gd" id="2_ytmxt"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://lqtpafx25sxi" path="res://assets/models/Flieger.obj" id="3_28a8u"]
|
[ext_resource type="ArrayMesh" uid="uid://lqtpafx25sxi" path="res://assets/models/Flieger.obj" id="3_28a8u"]
|
||||||
|
|
||||||
[sub_resource type="Curve3D" id="Curve3D_jm5wf"]
|
[sub_resource type="Curve3D" id="Curve3D_jm5wf"]
|
||||||
|
|
@ -103,7 +104,9 @@ transform = Transform3D(0.999999, 0.000245532, 0.00101596, -0.000244175, 0.99999
|
||||||
[node name="FliegerBase" type="Node3D" parent="."]
|
[node name="FliegerBase" type="Node3D" parent="."]
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.484031, 0.875051, 0, -0.875051, 0.484031, 0, 23.5809, 16.7921)
|
transform = Transform3D(1, 0, 0, 0, 0.484031, 0.875051, 0, -0.875051, 0.484031, 0, 23.5809, 16.7921)
|
||||||
|
script = ExtResource("2_ytmxt")
|
||||||
|
|
||||||
[node name="CharacterBody3D" type="CharacterBody3D" parent="." node_paths=PackedStringArray("waypoints")]
|
[node name="CharacterBody3D" type="CharacterBody3D" parent="." node_paths=PackedStringArray("waypoints")]
|
||||||
script = ExtResource("2_28a8u")
|
script = ExtResource("2_28a8u")
|
||||||
|
|
|
||||||
BIN
workbench/pics/figure-skating-silhouette-000000-lg.jpg
Normal file
BIN
workbench/pics/figure-skating-silhouette-000000-lg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
workbench/pics/figure-skating-silhouette-000000-lg.png
Normal file
BIN
workbench/pics/figure-skating-silhouette-000000-lg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
BIN
workbench/pics/figure-skating-silhouette-small.jpg
Normal file
BIN
workbench/pics/figure-skating-silhouette-small.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
workbench/pics/figure-skating-silhouette-small.png
Normal file
BIN
workbench/pics/figure-skating-silhouette-small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3 KiB |
BIN
workbench/videos/2025-07-27_10-09-46.mp4
Normal file
BIN
workbench/videos/2025-07-27_10-09-46.mp4
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue