added cam height change script

This commit is contained in:
derek
2025-06-25 12:47:16 -05:00
parent b41781f3f7
commit a71bb712c5
7 changed files with 50 additions and 2 deletions

28
Scripts/camera_Look.gd Normal file
View File

@@ -0,0 +1,28 @@
extends Camera3D
var height_target = position.y
const CHANGE_AMT_ON_SCROLL = 4.0
const CAM_CHANGE_SPEED = 2.0
var MAX_CAM_HEIGHT = position.y + CHANGE_AMT_ON_SCROLL
var MIN_CAM_HEIGHT = position.y - (CHANGE_AMT_ON_SCROLL * 2)
func _process(delta: float) -> void:
look_at(get_parent().global_position,Vector3.UP)
camera_height_change(delta)
func camera_height_change(delta):
#if global_position.y == height_target:
if Input.is_action_just_pressed("scroll_down"):
height_target = clamp(height_target - CHANGE_AMT_ON_SCROLL,MIN_CAM_HEIGHT,MAX_CAM_HEIGHT)
if Input.is_action_just_pressed("scroll_up"):
height_target = clamp(height_target + CHANGE_AMT_ON_SCROLL,MIN_CAM_HEIGHT,MAX_CAM_HEIGHT)
global_position.y = height_target
#else:
#var direction_to_target = global_position.y - height_target
#var move_amount = direction_to_target * delta * CAM_CHANGE_SPEED
#global_position.y += move_amount
#height_target -= move_amount

View File

@@ -0,0 +1 @@
uid://bnqpqdped5uw2