mousePosition.x value type. (Equations involving coordinates)

Hi guys I really hope someone of you could help me.

I am trying to calculate a position for an object to appear based on my mouse clicks.
In this picture Imgur: The magic of the Internet
“C” is where I click mouse and “D” is where I release the button. I want an object to appear on the same line as these points at the top of the screen (Point “A”).

I have laid down the equation, that I would need to calculate the “x” value of the point, but I can not figure out how to do it in script. Can mousePosition.x be used as a float and then back as a position for object or are there some another way?

Converting a 2D point to 3D world results in a line, not a point. To convert to a point, you must supply an extra information - usually the distance from the camera. In ScreenToWorldPoint(x, y, z), for instance, x and y are the screen coordinates (Input.mousePosition, for instance) and z is the distance from the camera. If you pass z=0, the camera position is returned, no matter which values you pass for x and y.

If you want to move a scene object while holding the mouse button down, you must create a ray from the mouse pointer and use it in Raycast to find the object; while the button is pressed, the object must follow the mouse pointer, and when the button is released the object rests in peace at the last point. There are two main alternatives for the movement: the object moves at a constant distance from the camera, or the object moves in the plane it was when the user clicked it. I answered a question about this last kind of movement in move and x and z axis in 3D - Questions & Answers - Unity Discussions (and about the constant distance too, but could not find it!)