private void moveTorch() { Vector2 positionOnScreen = cam.WorldToViewportPoint(player.transform.position); //Get the Screen position of the mouse Vector2 mouseOnScreen = (Vector2)cam.ScreenToViewportPoint(Input.mousePosition); //Get position between character and mouse Vector2 arm = (mouseOnScreen - positionOnScreen).normalized * armLength; Vector2 position = new Vector2(player.transform.position.x, player.transform.position.y) + arm; //Get the angle between the character and mouse float angle = AngleBetweenTwoPoints(positionOnScreen, mouseOnScreen); spotlight.MoveToMouse(position, angle); }