added cam height change script
This commit is contained in:
Binary file not shown.
@@ -32,7 +32,14 @@ animation/trimming=false
|
|||||||
animation/remove_immutable_tracks=true
|
animation/remove_immutable_tracks=true
|
||||||
animation/import_rest_as_RESET=false
|
animation/import_rest_as_RESET=false
|
||||||
import_script/path=""
|
import_script/path=""
|
||||||
_subresources={}
|
_subresources={
|
||||||
|
"materials": {
|
||||||
|
"METAL": {
|
||||||
|
"use_external/enabled": true,
|
||||||
|
"use_external/path": "uid://bu7m0jajko2q4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
blender/nodes/visible=0
|
blender/nodes/visible=0
|
||||||
blender/nodes/active_collection_only=false
|
blender/nodes/active_collection_only=false
|
||||||
blender/nodes/punctual_lights=true
|
blender/nodes/punctual_lights=true
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://hmyrn2pbbhpm"]
|
[gd_scene load_steps=7 format=3 uid="uid://hmyrn2pbbhpm"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bici4k5vkuoos" path="res://Scripts/player_camera.gd" id="1_ocbkm"]
|
[ext_resource type="Script" uid="uid://bici4k5vkuoos" path="res://Scripts/player_camera.gd" id="1_ocbkm"]
|
||||||
|
[ext_resource type="Script" uid="uid://bnqpqdped5uw2" path="res://Scripts/camera_Look.gd" id="2_8uhk6"]
|
||||||
[ext_resource type="FontFile" uid="uid://peikxwadqo68" path="res://Assets/Fonts/UnifrakturCook-Bold.ttf" id="2_70173"]
|
[ext_resource type="FontFile" uid="uid://peikxwadqo68" path="res://Assets/Fonts/UnifrakturCook-Bold.ttf" id="2_70173"]
|
||||||
|
|
||||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_ocbkm"]
|
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_ocbkm"]
|
||||||
@@ -31,6 +32,7 @@ script = ExtResource("1_ocbkm")
|
|||||||
transform = Transform3D(1, 0, 0, 0, 0.34202, 0.939693, 0, -0.939693, 0.34202, 0, 10, 3)
|
transform = Transform3D(1, 0, 0, 0, 0.34202, 0.939693, 0, -0.939693, 0.34202, 0, 10, 3)
|
||||||
attributes = SubResource("CameraAttributesPractical_ocbkm")
|
attributes = SubResource("CameraAttributesPractical_ocbkm")
|
||||||
fov = 80.0
|
fov = 80.0
|
||||||
|
script = ExtResource("2_8uhk6")
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="Camera3D"]
|
[node name="Control" type="Control" parent="Camera3D"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|||||||
28
Scripts/camera_Look.gd
Normal file
28
Scripts/camera_Look.gd
Normal 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
|
||||||
|
|
||||||
1
Scripts/camera_Look.gd.uid
Normal file
1
Scripts/camera_Look.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bnqpqdped5uw2
|
||||||
@@ -50,6 +50,16 @@ dodge={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
scroll_up={
|
||||||
|
"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
scroll_down={
|
||||||
|
"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user