void CalcCursorWorldPoint() { float resScale = videoSettings.GetInternalResScale(); Camera cam = playerManager.GetMainPlayerCam(); if (mouseColOffset == Vector3.zero) { mouseColOffset = mouseCollider.transform.position - cam.transform.position; } mouseCollider.transform.position = cam.transform.position + mouseColOffset; Ray ray = cam.ScreenPointToRay(new Vector3(cursorScreenPos.x * resScale, cursorScreenPos.y * resScale)); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, Mathf.Infinity, mouseColLayer)) { cursorWorldPos = hit.point; } }