// Change the energy when the player touch the monitor. // The first-touched position is recorded and adjusted for the inistantiation of ball public void OnPointerDown(PointerEventData eventData) { if (Ball.isThrown) { return; } var cam = Camera.main; Vector3 touchPosition = eventData.position; touchPosition.z = cam.nearClipPlane + 1; worldPosition = cam.ScreenToWorldPoint(touchPosition); energyBar.ChargeEnergy(); }