解决旋转反向问题
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user