# Convert Minimap render texture to 3d space position

## Convert Minimap render texture to 3d space position

```I am using Render texture to make a Mini Map it is working fine but now I want to go further on side map and want world space position from render texture click point.
Is there any way available that i get world space position from render texture's specific click point?
If i click somewhere in render texture then, how can I get that point in 3D world space.
For example, I click a car object on render texture How can I highlight or get it in 3D world space.?
Update: Actual Scenario is:

One Main Camera Rendering the Scene.
NGUI Camera Rendering the GUI.
That GUI contains the Render Texture(minimap) which rendering the
scene on texture using GUI Camera.

Now how can i get 3D position from 2D render texture!
```

I am not aware of an easy way of doing this. The way I’d do this is the following:

• Determine XY position of click on texture (x = 0..1, y = 0..1) How to do this depends on where you use it, but will likely require raycasting.
• Go to the camera that sends the image to the texture.

Assuming the camera uses perspective projection:

• Calculate the 3D position on the camera’s far plane that is at position x and y (xy was derived earlier from the texture)
• Do a raycast from the camera’s position to this calculated position on the far plane.
• The first position it hits (in 3D) is the 3D position of what was clicked on. If nothing is hit, then it’s the position on the far plane.

Assuming the camera uses orthogonal projection:

• Determine XYZ position of point on the near plane that is at the XY position, determined from the template
• Determine XYZ position of point on the far plane that is at the XY position, determined from the template
• Do a raycast from the position on the near plane to the one on the far plane.
• The first position it hits (in 3D) is the 3D position of what was clicked on. If nothing is hit, then it’s the position on the far plane.

Now determining all of this requires some knowledge of vector math. I’m however not aware of any simpler way of doing it, at least if you want to use the Rendered Texture. It may be easier to do if you simply overlay the camera’s output on the main viewport (by setting Viewport Rect parameters on the minimap camera)