解决旋转反向问题

This commit is contained in:
SepComet
2026-04-07 21:33:05 +08:00
parent b7c003f227
commit da2b93e59c
7 changed files with 69 additions and 4 deletions
@@ -174,6 +174,11 @@ namespace Network.NetworkHost
IntegrateState(state, configuration.SimulationInterval);
}
foreach (var state in statesByPeer.Values)
{
state.HasInputThisFrame = false;
}
accumulatedBroadcastTime += configuration.SimulationInterval;
while (accumulatedBroadcastTime >= configuration.BroadcastInterval)
{
@@ -362,6 +367,7 @@ namespace Network.NetworkHost
state.LastAcceptedMoveTick = input.Tick;
state.InputX = ClampInput(input.TurnInput);
state.InputY = ClampInput(input.ThrottleInput);
state.HasInputThisFrame = true;
if (state.InputY == 0f)
{
@@ -390,6 +396,16 @@ namespace Network.NetworkHost
return;
}
if (!state.HasInputThisFrame)
{
state.InputX = 0f;
state.InputY = 0f;
state.VelocityX = 0f;
state.VelocityY = 0f;
state.VelocityZ = 0f;
return;
}
var turnInput = ClampInput(state.InputX);
var throttleInput = ClampInput(state.InputY);
if (turnInput != 0f)
@@ -46,6 +46,8 @@ namespace Network.NetworkHost
public float InputY { get; internal set; }
public bool HasInputThisFrame { get; internal set; }
public float Speed { get; internal set; }
}
}