diff --git a/addons/HLNC/Serialization/NetworkScenesRegister.cs b/addons/HLNC/Serialization/NetworkScenesRegister.cs index 89e3dd2..1e409f3 100644 --- a/addons/HLNC/Serialization/NetworkScenesRegister.cs +++ b/addons/HLNC/Serialization/NetworkScenesRegister.cs @@ -37,6 +37,9 @@ public partial class NetworkScenesRegister : Node internal static Dictionary> NODE_PATHS_PACK = []; + /// + /// A map of every packed scene to a list of paths to its internal network nodes. + /// internal static Dictionary> STATIC_NETWORK_NODE_PATHS = []; /// diff --git a/addons/HLNC/Serialization/Serializers/NetworkPropertiesSerializer.cs b/addons/HLNC/Serialization/Serializers/NetworkPropertiesSerializer.cs index a6f19d4..bdc70cf 100644 --- a/addons/HLNC/Serialization/Serializers/NetworkPropertiesSerializer.cs +++ b/addons/HLNC/Serialization/Serializers/NetworkPropertiesSerializer.cs @@ -238,6 +238,7 @@ public void PhysicsProcess(double delta) var lerpNode = wrapper.Node.GetNode(toLerp.Prop.NodePath); if (toLerp.Weight < 1.0) { + toLerp.Weight = Math.Min(toLerp.Weight + delta * 10, 1.0); double result = -1; if (lerpNode.HasMethod("NetworkLerp" + toLerp.Prop.Name)) { @@ -250,7 +251,6 @@ public void PhysicsProcess(double delta) if (result == -1) { // TODO: If this is too fast, it creates a jitter effect - toLerp.Weight = Math.Min(toLerp.Weight + delta * 10, 1.0); if (toLerp.Prop.Type == Variant.Type.Quaternion) { var next_value = ((Quaternion)toLerp.From).Normalized().Slerp(((Quaternion)toLerp.To).Normalized(), (float)toLerp.Weight); diff --git a/addons/HLNC/Utilities/NetworkTransform.cs b/addons/HLNC/Utilities/NetworkTransform.cs index ee80c03..8827241 100644 --- a/addons/HLNC/Utilities/NetworkTransform.cs +++ b/addons/HLNC/Utilities/NetworkTransform.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics; using Godot; using Godot.Collections; @@ -6,6 +7,7 @@ namespace HLNC.Utilities { public partial class NetworkTransform : NetworkNode3D { + public bool teleporting = true; [Export] @@ -99,6 +101,14 @@ public double NetworkLerpNetPosition(Variant from, Variant to, double weight) return -1; } + public double NetworkLerpNetRotation(Variant from, Variant to, double weight) + { + Vector3 start = from.AsVector3(); + Vector3 end = to.AsVector3(); + NetRotation = new Vector3((float)Mathf.LerpAngle(start.X, end.X, weight), (float)Mathf.LerpAngle(start.Y, end.Y, weight), (float)Mathf.LerpAngle(start.Z, end.Z, weight)); + return weight; + } + public override void _PhysicsProcess(double delta) { base._PhysicsProcess(delta); diff --git a/addons/HLNC/plugin.cfg b/addons/HLNC/plugin.cfg index 20edd71..7d1fea4 100644 --- a/addons/HLNC/plugin.cfg +++ b/addons/HLNC/plugin.cfg @@ -3,5 +3,5 @@ name="HLNC" description="Netcode Framework for Online Multiplayer Games" author="Wyatt Arent" -version="0.4.0" +version="0.5.0" script="plugin.gd"