Predicted Billiards Example: remove old 'inputs' code

This commit is contained in:
mischa 2024-04-02 16:26:50 +08:00 committed by MrGadget
parent b3225032ae
commit 3cc1bc0431

View File

@ -23,10 +23,6 @@ public class PlayerPredicted : NetworkBehaviour
// white ball component
WhiteBallPredicted whiteBall;
// keep a history of inputs with timestamp
public int inputHistorySize = 64;
readonly SortedList<double, PlayerInput> inputs = new SortedList<double, PlayerInput>();
void Awake()
{
// find the white ball once
@ -62,11 +58,6 @@ void ApplyForceToWhite(Vector3 force)
// we reuse the white ball's OnMouseDrag and forward the event to here.
public void OnDraggedBall(Vector3 force)
{
// record the input for reconciliation if needed
if (inputs.Count >= inputHistorySize) inputs.RemoveAt(0);
inputs.Add(NetworkTime.time, new PlayerInput(NetworkTime.time, force));
Debug.Log($"Inputs.Count={inputs.Count}");
// apply force locally immediately
ApplyForceToWhite(force);