diff --git a/Assets/Mirror/Examples/BilliardsPredicted/Ball/WhiteBallPredicted.cs b/Assets/Mirror/Examples/BilliardsPredicted/Ball/WhiteBallPredicted.cs index 16996b1bf..42372905d 100644 --- a/Assets/Mirror/Examples/BilliardsPredicted/Ball/WhiteBallPredicted.cs +++ b/Assets/Mirror/Examples/BilliardsPredicted/Ball/WhiteBallPredicted.cs @@ -35,72 +35,6 @@ void Awake() startPosition = transform.position; } - [ClientCallback] - void Update() - { - // mouse down on the white ball? - if (Input.GetMouseButtonDown(0)) - { - if (MouseToWorld(out Vector3 position)) - { - // allow dragging if mouse is 'close enough'. - // balls are moving so we don't need to be exactly on it. - float distance = Vector3.Distance(position, transform.position); - if (distance <= dragTolerance) - { - // enable drag indicator - dragIndicator.SetPosition(0, transform.position); - dragIndicator.SetPosition(1, transform.position); - dragIndicator.gameObject.SetActive(true); - - draggingStartedOverObject = true; - } - } - } - // mouse button dragging? - else if (Input.GetMouseButton(0)) - { - // cast mouse position to world - if (draggingStartedOverObject && MouseToWorld(out Vector3 current)) - { - // drag indicator - dragIndicator.SetPosition(0, transform.position); - dragIndicator.SetPosition(1, current); - } - } - // mouse button up? - else if (Input.GetMouseButtonUp(0)) - { - // cast mouse position to world - if (draggingStartedOverObject && MouseToWorld(out Vector3 current)) - { - // calculate delta from ball to mouse - // ball may have moved since we started dragging, - // so always use current ball position here. - Vector3 from = transform.position; - - // debug drawing: only works if Gizmos are enabled! - Debug.DrawLine(from, current, Color.white, 2); - - // calculate pending force delta - Vector3 delta = from - current; - Vector3 force = delta * forceMultiplier; - - // there should be a maximum allowed force - force = Vector3.ClampMagnitude(force, maxForce); - - // forward the event to the local player's object. - // the ball isn't part of the local player. - NetworkClient.localPlayer.GetComponent().OnDraggedBall(force); - - // disable drag indicator - dragIndicator.gameObject.SetActive(false); - } - - draggingStartedOverObject = false; - } - } - [ClientCallback] void OnMouseDown() {