/// <summary> /// simulate the input locally and store it /// until the server has an update that's later than that input /// </summary> /// <param name="input"></param> public Vector3 AddInput(CharacterInput input) { //predict the outcome ApplyInput(input, out Vector3 _position, out Quaternion _rotation); input.predictedResult = _position; pendingInputs.AddLast(input); character.SyncPosition(predictedState); //make the move phyisically predictedState.position = character.transform.position; //save the position we get back from the character controller //return the result of the calculation return(_position); }
void SetObservedState(CharacterState newState) { character.SyncPosition(newState); character.SyncRotation(newState); }