From 53865f8571cc00cff4affb130cd60ded7d8d76bd Mon Sep 17 00:00:00 2001 From: vaporvee Date: Mon, 2 Jan 2023 19:22:58 +0100 Subject: [PATCH] improved rotation jitter fix --- project.godot | 1 + src/essential.cs | 1 + src/player.cs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/project.godot b/project.godot index 6a30bef..04b85aa 100644 --- a/project.godot +++ b/project.godot @@ -13,6 +13,7 @@ config_version=5 config/name="test 3d project" run/main_scene="res://scenes/main.tscn" config/features=PackedStringArray("4.0", "C#", "Forward Plus") +run/max_fps=144 boot_splash/show_image=false config/icon="res://icon.svg" diff --git a/src/essential.cs b/src/essential.cs index 7b96d93..6ef7919 100644 --- a/src/essential.cs +++ b/src/essential.cs @@ -5,6 +5,7 @@ public partial class essential : Node { public override void _Ready() { + ProjectSettings.SetSetting("physics/common/physics_ticks_per_second", Performance.GetMonitor(Performance.Monitor.TimeFps)); } public override void _Process(double delta) diff --git a/src/player.cs b/src/player.cs index 08c62f2..1048d89 100644 --- a/src/player.cs +++ b/src/player.cs @@ -32,7 +32,7 @@ public partial class player : CharacterBody3D velocity.x = direction.x * Speed; velocity.z = direction.z * Speed; Vector3 bodyRotation = GetNode("collision/body").Rotation; - bodyRotation.y = Mathf.LerpAngle(bodyRotation.y,Mathf.Atan2(-direction.x, -direction.z), (float)delta * Speed); + bodyRotation.y = Mathf.LerpAngle(bodyRotation.y,Mathf.Atan2(-direction.x, -direction.z), (float)delta * Speed * 1.5f); GetNode("collision/body").Rotation = bodyRotation; } else