improved rotation jitter fix
This commit is contained in:
@@ -13,6 +13,7 @@ config_version=5
|
|||||||
config/name="test 3d project"
|
config/name="test 3d project"
|
||||||
run/main_scene="res://scenes/main.tscn"
|
run/main_scene="res://scenes/main.tscn"
|
||||||
config/features=PackedStringArray("4.0", "C#", "Forward Plus")
|
config/features=PackedStringArray("4.0", "C#", "Forward Plus")
|
||||||
|
run/max_fps=144
|
||||||
boot_splash/show_image=false
|
boot_splash/show_image=false
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ public partial class essential : Node
|
|||||||
{
|
{
|
||||||
public override void _Ready()
|
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 void _Process(double delta)
|
||||||
|
@@ -32,7 +32,7 @@ public partial class player : CharacterBody3D
|
|||||||
velocity.x = direction.x * Speed;
|
velocity.x = direction.x * Speed;
|
||||||
velocity.z = direction.z * Speed;
|
velocity.z = direction.z * Speed;
|
||||||
Vector3 bodyRotation = GetNode<MeshInstance3D>("collision/body").Rotation;
|
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;
|
GetNode<MeshInstance3D>("collision/body").Rotation = bodyRotation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user