4 Commits
1.1 ... 1.2

2 changed files with 13 additions and 8 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=144
boot_splash/show_image=false
config/icon="res://icon.png"
@@ -72,7 +71,6 @@ uncapture_mouse={
[physics]
common/physics_ticks_per_second=144
3d/default_gravity=12.0
[rendering]

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(1.5f), "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"))
{