AIR MOVEMENT

This commit is contained in:
2026-01-03 07:41:22 +02:00
parent 1921344ddb
commit 709b9eec93
46 changed files with 312 additions and 38 deletions

View File

@@ -100,11 +100,11 @@ Anim={
"translate_snap": 1.0,
"viewport_mode": 1,
"viewports": [{
"auto_orthogonal": false,
"auto_orthogonal": true,
"auto_orthogonal_enabled": true,
"cinematic_preview": false,
"display_mode": 22,
"distance": 40.250706,
"distance": 1.8527803,
"doppler": false,
"frame_time": false,
"gizmos": true,
@@ -113,13 +113,13 @@ Anim={
"information": false,
"listener": true,
"lock_rotation": false,
"orthogonal": false,
"position": Vector3(1.0176355, -2.1000533, -11.70047),
"orthogonal": true,
"position": Vector3(-4.8259034, 0.74621856, -1.2634671),
"transform_gizmo": true,
"use_environment": false,
"view_type": 0,
"x_rotation": 0.09083431,
"y_rotation": -0.011306619
"view_type": 4,
"x_rotation": 0.0,
"y_rotation": -1.5707964
}, {
"auto_orthogonal": false,
"auto_orthogonal_enabled": true,
@@ -187,4 +187,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@21413/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10871/@VSplitContainer@10516/@HSplitContainer@10518/@HSplitContainer@10520/@Control@10521/@SubViewportContainer@10522/@SubViewport@10523/Node3D")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@20438/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10871/@VSplitContainer@10516/@HSplitContainer@10518/@HSplitContainer@10520/@Control@10521/@SubViewportContainer@10522/@SubViewport@10523/Node3D/CollisionShape3D")])

View File

@@ -1,5 +1,5 @@
[folding]
node_unfolds=[]
resource_unfolds=["res://Floor.tscn::BoxMesh_spmh5", PackedStringArray(), "res://Floor.tscn::BoxShape3D_spmh5", PackedStringArray()]
node_unfolds=[NodePath("CSGMesh3D"), PackedStringArray("material"), NodePath("CollisionShape3D"), PackedStringArray("Transform")]
resource_unfolds=["res://Floor.tscn::BoxMesh_spmh5", PackedStringArray(), "res://Floor.tscn::StandardMaterial3D_yrkb7", PackedStringArray(), "res://Floor.tscn::BoxShape3D_spmh5", PackedStringArray()]
nodes_folded=[]

View File

@@ -187,4 +187,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@20438/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10871/@VSplitContainer@10516/@HSplitContainer@10518/@HSplitContainer@10520/@Control@10521/@SubViewportContainer@10522/@SubViewport@10523/Player")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@20438/@Panel@14/@VBoxContainer@15/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@26/DockVSplitCenter/@VSplitContainer@62/@VBoxContainer@63/@EditorMainScreen@103/MainScreen/@CanvasItemEditor@10871/@VSplitContainer@10516/@HSplitContainer@10518/@HSplitContainer@10520/@Control@10521/@SubViewportContainer@10522/@SubViewport@10523/Player/CameraPivot/Camera3D")])

View File

@@ -9,8 +9,8 @@ dock_filesystem_v_split_offset=0
dock_filesystem_display_mode=0
dock_filesystem_file_sort=0
dock_filesystem_file_list_display_mode=1
dock_filesystem_selected_paths=PackedStringArray("res://DevTest.tscn")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://")
dock_filesystem_selected_paths=PackedStringArray("res://assets/Materials/stone_pathway/textures/stone_pathway_02_nor_gl_1k.png")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://assets/", "res://assets/Materials/", "res://assets/Materials/stone_pathway/", "res://assets/Materials/stone_pathway/textures/")
dock_node_current_tab=0
dock_history_include_scene=true
dock_history_include_global=true
@@ -19,7 +19,7 @@ dock_closed=[]
dock_split_2=0
dock_split_3=0
dock_hsplit_1=0
dock_hsplit_2=270
dock_hsplit_2=395
dock_hsplit_3=-270
dock_hsplit_4=0
dock_3="Scene,Import"
@@ -28,11 +28,11 @@ dock_5="Inspector,Node,History"
[EditorNode]
open_scenes=PackedStringArray("res://Floor.tscn", "res://Player.tscn")
current_scene="res://Player.tscn"
open_scenes=PackedStringArray("res://Floor.tscn")
current_scene="res://Floor.tscn"
center_split_offset=0
selected_default_debugger_tab_idx=1
selected_main_editor_idx=1
selected_default_debugger_tab_idx=0
selected_main_editor_idx=2
selected_bottom_panel_item=0
[EditorWindow]

View File

@@ -1,9 +1,16 @@
63f7b34db8d8cdea90c76aacccf841ec
::res://::1767414802
::res://::1767415906
DevTest.tscn::PackedScene::9123247578013174228::1767411651::0::1::::<><><>0<>0<><>::uid://grcsjnqdsbmj::::res://Floor.tscn<>uid://dsj41jw17qh40::::res://Player.tscn
Floor.tscn::PackedScene::456381555447325093::1767411339::0::1::::<><><>0<>0<><>::
Player.tscn::PackedScene::8443048367702749007::1767414773::0::1::::<><><>0<>0<><>::uid://b8ddkhlwoiuvm::::res://Scripts/player.gd
::res://assets/::1767410719
Player.tscn::PackedScene::8443048367702749007::1767415906::0::1::::<><><>0<>0<><>::uid://b8ddkhlwoiuvm::::res://Scripts/player.gd
::res://assets/::1767416168
icon.svg::CompressedTexture2D::347234531240620840::1767410708::1767410719::1::::<><><>0<>0<>cd8caee1c8a7b4b3cbd67faa4c96c3c0<>res://.godot/imported/icon.svg-56083ea2a1f1a4f1e49773bdc6d7826c.ctex::
::res://Scripts/::1767414773
player.gd::GDScript::4709046051602623302::1767414773::0::1::::<>CharacterBody3D<><>0<>0<><>::
::res://assets/Materials/::1767416391
::res://assets/Materials/stone_pathway/::1767416379
::res://assets/Materials/stone_pathway/textures/::1767416516
stone_pathway_02_diff_1k.png::CompressedTexture2D::8710570804227902040::1767416372::1767416409::1::::<><><>0<>0<>024744925d268103fd25f3e5fec2366c<>res://.godot/imported/stone_pathway_02_diff_1k.png-120f486f1110be0c1fbd52209fdcc8de.s3tc.ctex::
stone_pathway_02_disp_1k.png::CompressedTexture2D::6812096667217185925::1767416372::1767416391::1::::<><><>0<>0<>add6b013cee511daf3f495c87865d6f9<>res://.godot/imported/stone_pathway_02_disp_1k.png-09ca21ec1b99b1589b5d080c3969064c.ctex::
stone_pathway_02_nor_gl_1k.png::CompressedTexture2D::8508944656639413126::1767416372::1767416516::1::::<><><>0<>0<>82cd783198cdc6e8bee4a3c3fa744c24<>res://.godot/imported/stone_pathway_02_nor_gl_1k.png-90a48320dd4c9c60b9e68fa350107138.s3tc.ctex::
stone_pathway_02_rough_1k.png::CompressedTexture2D::7133228485628055815::1767416372::1767416631::1::::<><><>0<>0<>ca9d6e30979c45204097877beba0ef3e<>res://.godot/imported/stone_pathway_02_rough_1k.png-7bc2e60cf9d95ba7753177c3883fca73.s3tc.ctex::
::res://Scripts/::1767415906
player.gd::GDScript::4709046051602623302::1767415906::0::1::::<>CharacterBody3D<><>0<>0<><>::

View File

@@ -1,2 +1,3 @@
res://Player.tscn
res://Scripts/player.gd
res://Floor.tscn

View File

@@ -30,3 +30,8 @@ recent_presets=PackedColorArray(0.39210242, 0.58253837, 1, 1, 0, 0, 1, 1, 0.0294
[project_settings]
show_builtin_actions=false
[inspector_options]
material_preview_rotation=Vector2(-15, 30)
material_preview_mesh="sphere"

View File

@@ -3,11 +3,11 @@
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 35,
"column": 31,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 37,
"scroll_position": 24.0,
"row": 97,
"scroll_position": 85.0,
"selection": false,
"syntax_highlighter": "GDScript"
}

View File

@@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

View File

@@ -0,0 +1,3 @@
source_md5="cd8f8a2145427a1afd87e4a853068ddb"
dest_md5="d098923582f798f6da1aea62d02784c6"

View File

@@ -0,0 +1,3 @@
source_md5="59eeaba98822dfe33663ef7cd20cc0cf"
dest_md5="14ba5718d3f49166462e842389fc42fa"

View File

@@ -0,0 +1,3 @@
source_md5="e013de5d49fe93eb1e1d662a1a8f09a9"
dest_md5="868065f62f70c39bdf02eaaa11e821de"

View File

@@ -0,0 +1,3 @@
source_md5="e013de5d49fe93eb1e1d662a1a8f09a9"
dest_md5="dff9bde5aba8b2d22c9a58783826b2c0"

View File

@@ -0,0 +1,3 @@
source_md5="b5182aa1e2313ef89a1c15e8fd456a5f"
dest_md5="3180e130cfec6748710c053a1f788f38"

View File

@@ -0,0 +1,3 @@
source_md5="b5182aa1e2313ef89a1c15e8fd456a5f"
dest_md5="6c2e442ba6124b73e442195d97764e3a"

View File

@@ -0,0 +1,3 @@
source_md5="b2f4dbe54630c5af235f113210d57196"
dest_md5="1da3284061bc22e503603fc373f7db89"

View File

@@ -0,0 +1,3 @@
source_md5="b2f4dbe54630c5af235f113210d57196"
dest_md5="8982eb18a4a6bd995399056e47413007"

Binary file not shown.

View File

@@ -1,16 +1,28 @@
[gd_scene load_steps=3 format=3 uid="uid://grcsjnqdsbmj"]
[gd_scene load_steps=7 format=3 uid="uid://grcsjnqdsbmj"]
[ext_resource type="Texture2D" uid="uid://dwdp3f073q201" path="res://assets/Materials/stone_pathway/textures/stone_pathway_02_diff_1k.png" id="1_ragr8"]
[ext_resource type="Texture2D" uid="uid://dth2ctcqe0nri" path="res://assets/Materials/stone_pathway/textures/stone_pathway_02_nor_gl_1k.png" id="2_sr8py"]
[ext_resource type="Texture2D" uid="uid://c8vnh4apwdyy6" path="res://assets/Materials/stone_pathway/textures/stone_pathway_02_rough_1k.png" id="3_3tt66"]
[sub_resource type="BoxMesh" id="BoxMesh_spmh5"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_yrkb7"]
albedo_texture = ExtResource("1_ragr8")
roughness_texture = ExtResource("3_3tt66")
normal_enabled = true
normal_texture = ExtResource("2_sr8py")
uv1_scale = Vector3(25, 25, 25)
[sub_resource type="BoxShape3D" id="BoxShape3D_spmh5"]
size = Vector3(59.669678, 0.817749, 55.40779)
size = Vector3(76.918335, 0.44656372, 87.31734)
[node name="Node3D" type="StaticBody3D"]
[node name="CSGMesh3D" type="CSGMesh3D" parent="."]
transform = Transform3D(56.361786, 0, 0, 0, 0.4602867, 0, 0, 0, 51.48, 0, 0, 0)
transform = Transform3D(76.742645, 0, 0, 0, 0.4602867, 0, 0, 0, 85.421776, 0, 0, 0)
mesh = SubResource("BoxMesh_spmh5")
material = SubResource("StandardMaterial3D_yrkb7")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3577881, -0.09112549, -1.934227)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.018493652, 0.0028533936, -1)
shape = SubResource("BoxShape3D_spmh5")

View File

@@ -20,3 +20,4 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.54473054, 0)
[node name="Camera3D" type="Camera3D" parent="CameraPivot"]
current = true
fov = 52.5

View File

@@ -3,12 +3,17 @@ extends CharacterBody3D
@export var mouse_sensitivity = 1
# ======== Movement Stuff
var air_accel = 1.0
var max_air_speed = 1.0
var fov = 70.0
const sliding_fov_add = 35.0
var sliding_fov
const walk_speed = 10.0
var crouch_speed = 5
var slide_speed = 25
var slide_friction = 5
var slide_speed = 15
var slide_friction =15
var slide_direction = Vector3.ZERO
const jump_velocity = 4.5
@@ -16,7 +21,7 @@ const jump_velocity = 4.5
# ========= Cam Stuff
var max_look_up = deg_to_rad(80)
var max_look_down = deg_to_rad(-80)
var crouch_height = 0.6
var crouch_height = 0.5
var stand_height = 1.0
var pitch = 0
@@ -25,11 +30,17 @@ var pitch = 0
# ========= Other Stuff
var is_crouching = false
var is_sliding = false
var preserve_air_momentum = false
var just_jumped = false
func _ready() -> void:
$CameraPivot/Camera3D.fov = fov
mouse_sensitivity = mouse_sensitivity * 0.001
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
sliding_fov = fov + sliding_fov_add
func _input(event: InputEvent) -> void:
@@ -60,7 +71,12 @@ func _physics_process(delta: float) -> void:
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
if Input.is_action_just_pressed("jump") and is_on_floor():
is_sliding = false
preserve_air_momentum = true
just_jumped = true
velocity.y = jump_velocity
var input_dir = Vector3.ZERO
@@ -74,13 +90,25 @@ func _physics_process(delta: float) -> void:
input_dir += transform.basis.x
input_dir = input_dir.normalized()
handle_crouch(input_dir, delta)
move_and_slide()
if is_on_floor():
just_jumped = false
preserve_air_momentum = false
handle_crouch(input_dir, delta)
else :
apply_air_control(input_dir, delta)
func handle_crouch(input_dir:Vector3, delta):
if just_jumped:
return
if not is_on_floor() and preserve_air_momentum:
return
if Input.is_action_just_pressed("crouch") and is_on_floor():
is_crouching = true
@@ -90,9 +118,21 @@ func handle_crouch(input_dir:Vector3, delta):
if Input.is_action_just_released("crouch"):
stop_crouch()
if input_dir == Vector3.ZERO and not is_sliding:
var horizontal = velocity
horizontal.y = 0
horizontal = horizontal.move_toward(Vector3.ZERO, slide_friction * delta)
velocity.x = horizontal.x
velocity.z = horizontal.z
if is_sliding:
$CameraPivot/Camera3D.fov = lerp($CameraPivot/Camera3D.fov, sliding_fov, 10 * delta )
velocity.x = slide_direction.x
velocity.z = slide_direction.z
@@ -105,6 +145,7 @@ func handle_crouch(input_dir:Vector3, delta):
velocity.x = input_dir.x * crouch_speed
velocity.z = input_dir.z * crouch_speed
else:
$CameraPivot/Camera3D.fov = lerp($CameraPivot/Camera3D.fov, fov, 10 * delta )
velocity.x = input_dir.x * walk_speed
velocity.z = input_dir.z * walk_speed
@@ -115,3 +156,20 @@ func start_slide(input_dir: Vector3):
func stop_crouch():
is_crouching = false
is_sliding = false
func apply_air_control(input_dir: Vector3, delta):
if input_dir == Vector3.ZERO:
return
var horizontal_vel = velocity
horizontal_vel.y = 0
var current_speed = horizontal_vel.dot(input_dir)
var add_speed = max_air_speed - current_speed
if add_speed <= 0:
return
var accel_speed = air_accel * delta * max_air_speed
accel_speed = min(accel_speed, add_speed)
velocity += input_dir * accel_speed

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB

View File

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dwdp3f073q201"
path.s3tc="res://.godot/imported/stone_pathway_02_diff_1k.png-120f486f1110be0c1fbd52209fdcc8de.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Materials/stone_pathway/textures/stone_pathway_02_diff_1k.png"
dest_files=["res://.godot/imported/stone_pathway_02_diff_1k.png-120f486f1110be0c1fbd52209fdcc8de.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c4b3ib2eh3qjd"
path="res://.godot/imported/stone_pathway_02_disp_1k.png-09ca21ec1b99b1589b5d080c3969064c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Materials/stone_pathway/textures/stone_pathway_02_disp_1k.png"
dest_files=["res://.godot/imported/stone_pathway_02_disp_1k.png-09ca21ec1b99b1589b5d080c3969064c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 MiB

View File

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dth2ctcqe0nri"
path.s3tc="res://.godot/imported/stone_pathway_02_nor_gl_1k.png-90a48320dd4c9c60b9e68fa350107138.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Materials/stone_pathway/textures/stone_pathway_02_nor_gl_1k.png"
dest_files=["res://.godot/imported/stone_pathway_02_nor_gl_1k.png-90a48320dd4c9c60b9e68fa350107138.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://assets/Materials/stone_pathway/textures/stone_pathway_02_nor_gl_1k.png"
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c8vnh4apwdyy6"
path.s3tc="res://.godot/imported/stone_pathway_02_rough_1k.png-7bc2e60cf9d95ba7753177c3883fca73.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Materials/stone_pathway/textures/stone_pathway_02_rough_1k.png"
dest_files=["res://.godot/imported/stone_pathway_02_rough_1k.png-7bc2e60cf9d95ba7753177c3883fca73.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0