custom actual working jitterfix

This commit is contained in:
2023-01-06 16:49:36 +01:00
parent 3c0c6ce9c0
commit eee59dfa6a
2 changed files with 13 additions and 7 deletions

View File

@@ -13,7 +13,6 @@ config_version=5
config/name="Godot Mono thirdperson controller"
run/main_scene="res://scenes/main.tscn"
config/features=PackedStringArray("4.0", "Forward Plus")
run/max_fps=60
boot_splash/show_image=false
config/icon="res://icon.png"

View File

@@ -3,12 +3,19 @@ using System;
public partial class window : Node
{
public override void _Ready()
{
ProjectSettings.SetSetting("physics/common/physics_ticks_per_second", Performance.GetMonitor(Performance.Monitor.TimeFps));
}
public override void _Process(double delta)
public override async void _Ready()
{
/* VSync should be used because needing to change the PhysicsTicksPerSecond in _Process takes CPU ussage
* You could also just set max FPS and delte this fix
*/
await ToSignal(GetTree().CreateTimer(2f), "timeout");//waits until the game has loaded some time
if (Engine.PhysicsTicksPerSecond != (int)Engine.GetFramesPerSecond())
{
Engine.PhysicsTicksPerSecond = (int)Engine.GetFramesPerSecond(); //PhysicsTicksPerSecond have to be the same value like current FPS or the movement will lagg
GD.Print("Set PhysicsTicksPerSecond to: " + Engine.PhysicsTicksPerSecond);
}
}
public override void _Process(double delta)
{
if (Input.IsActionJustPressed("fullscreen"))
{