I'm learning a course on unity and when we started learning about taking mouse input the following code is used.
Vector3 pos = Input.mousePosition; pos.z = -Camera.main.transform.position.z; pos = Camera.main.ScreenToWorldPoint(pos); gameObject.transform.position = pos;
My problem is in the second line. Shouldn't our Z be 0 instead of minus wherever our camera is? Because the plane where we our designing our game is in z = 0, right?
Please go slow on me I'm still new to unity. Thank you!