From 5f0040434a738f1882578cf04026a28df201ad05 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 1 Oct 2023 22:07:33 -0400 Subject: [PATCH 1/2] More debugging Fixed noclip y movement Chenged QUAKE again Split speed overlay into H and V --- Debug.gd | 5 ++++- Player.gd | 5 ++--- assets | 2 +- world.tscn | 9 ++++++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Debug.gd b/Debug.gd index f302e75..74fa1a1 100644 --- a/Debug.gd +++ b/Debug.gd @@ -8,7 +8,10 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - $Speed.text = 'Speed: {0}'.format([$Player.velocity.length()]) + var v = $Player.velocity + var hvel = sqrt(v.x ** 2 + v.z ** 2) + var vvel = v.y + $Speed.text = 'Speed: %6.2f, %6.2f' % [hvel, vvel] func _input(event: InputEvent): diff --git a/Player.gd b/Player.gd index 9a23af1..477268a 100644 --- a/Player.gd +++ b/Player.gd @@ -1,7 +1,7 @@ extends CharacterBody3D # Member variables -const QUAKE = 8 * 0.013888888888888888 +const QUAKE = 0.0625 const g = -800 * QUAKE const MAX_SPEED = 2000 * QUAKE const FRICTION = 4 * QUAKE @@ -45,7 +45,6 @@ func _physics_process(delta): if Input.is_action_pressed("run"): fmove *= 2.0 smove *= 2.0 - upmove *= 2.0 var wishvel = Vector3() var cam_xform: Transform3D = camera.get_global_transform() @@ -54,7 +53,7 @@ func _physics_process(delta): wishvel = cam_basis.z * fmove + cam_basis.x * smove if _noclip: - wishvel.y = upmove + wishvel.y += upmove # else: # wishvel.y = upmove diff --git a/assets b/assets index c82fba3..1bb78ec 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit c82fba33a3fb4ad42210a56d670bc2271c171e98 +Subproject commit 1bb78ec55825d3d21d87ba297a5cab46dd5833cc diff --git a/world.tscn b/world.tscn index 0ece8bd..5684962 100644 --- a/world.tscn +++ b/world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://cv8621s5oukrb"] +[gd_scene load_steps=12 format=3 uid="uid://cv8621s5oukrb"] [ext_resource type="PackedScene" uid="uid://dyyf1q12dchhq" path="res://Player.tscn" id="2_jba6q"] [ext_resource type="PackedScene" uid="uid://cp4rwojl3c3y3" path="res://test.tscn" id="3_wlkcu"] @@ -17,6 +17,12 @@ font_size = 69 outline_size = 24 outline_color = Color(0, 0, 0, 1) +[sub_resource type="SystemFont" id="SystemFont_4l16k"] +font_names = PackedStringArray("Monospace") + +[sub_resource type="LabelSettings" id="LabelSettings_f35h2"] +font = SubResource("SystemFont_4l16k") + [node name="Root" type="Node"] script = ExtResource("7_2k2sn") @@ -58,3 +64,4 @@ offset_top = 99.0 offset_right = 113.0 offset_bottom = 136.0 text = "SPEED" +label_settings = SubResource("LabelSettings_f35h2") From 5bf40d53576b9f6c52f5d668d2effb34d81936a0 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 1 Oct 2023 22:18:35 -0400 Subject: [PATCH 2/2] Dont apply quake constant to friction and accel? --- Player.gd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Player.gd b/Player.gd index 477268a..dbffbe8 100644 --- a/Player.gd +++ b/Player.gd @@ -4,9 +4,9 @@ extends CharacterBody3D const QUAKE = 0.0625 const g = -800 * QUAKE const MAX_SPEED = 2000 * QUAKE -const FRICTION = 4 * QUAKE +const FRICTION = 4# * QUAKE const STOP_SPEED = 100 * QUAKE -const ACCEL= 10 * QUAKE +const ACCEL= 10# * QUAKE const FORWARD_SPEED = 200 * QUAKE const SIDE_SPEED = 350 * QUAKE const UP_SPEED = 270 * QUAKE