From 874ef1f81735017d67cc49005cc43b7a23dfbd85 Mon Sep 17 00:00:00 2001 From: Zakarya Date: Tue, 9 Jan 2024 09:55:33 -0800 Subject: [PATCH] Take changes from #2 and apply them with the style of the rest of the code --- addons/fpc/character.gd | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/addons/fpc/character.gd b/addons/fpc/character.gd index 25adb70..19da935 100644 --- a/addons/fpc/character.gd +++ b/addons/fpc/character.gd @@ -62,10 +62,16 @@ func _ready(): func _physics_process(delta): - # Add some debug data $UserInterface/DebugPanel.add_property("Movement Speed", speed, 1) - $UserInterface/DebugPanel.add_property("Velocity", get_real_velocity(), 2) + var cv : Vector3 = get_real_velocity() + var vd : Array[float] = [ + snappedf(cv.x, 0.001), + snappedf(cv.y, 0.001), + snappedf(cv.z, 0.001) + ] + var readable_velocity : String = "X: " + str(vd[0]) + " Y: " + str(vd[1]) + " Z: " + str(vd[2]) + $UserInterface/DebugPanel.add_property("Velocity", readable_velocity, 2) # Gravity #gravity = ProjectSettings.get_setting("physics/3d/default_gravity") # If the gravity changes during your game, uncomment this code @@ -204,8 +210,11 @@ func headbob_animation(moving): func _process(delta): - $UserInterface/DebugPanel.add_property("FPS", 1.0/delta, 0) - $UserInterface/DebugPanel.add_property("State", state, 0) + $UserInterface/DebugPanel.add_property("FPS", Performance.get_monitor(Performance.TIME_FPS), 0) + var status : String = state + if !is_on_floor(): + status += " in the air" + $UserInterface/DebugPanel.add_property("State", status, 0) if Input.is_action_just_pressed(PAUSE): if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: