improved rotation jitter fix

This commit is contained in:
2023-01-02 19:22:58 +01:00
parent 074c70c157
commit 53865f8571
3 changed files with 3 additions and 1 deletions

View File

@@ -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"

View File

@@ -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)

View File

@@ -32,7 +32,7 @@ public partial class player : CharacterBody3D
velocity.x = direction.x * Speed;
velocity.z = direction.z * Speed;
Vector3 bodyRotation = GetNode<MeshInstance3D>("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<MeshInstance3D>("collision/body").Rotation = bodyRotation;
}
else