- Home /
Raycast on mini-map
I am using two cameras and one of them are overlapping the bigger one. The main camera is the big one and the overlapping is a mini-map i have made. I use raycast to move my character and i want to be able to press on the map to faster get to the point. But when i do i move the character to the place under the mini-map (on the main camera).
Why don't the raycast work on the other camera?
Answer by Berenger · May 26, 2012 at 04:52 AM
You are probably using one of Camera's function to build the ray you cast. Depending on weither you're hover the mini map or not, you mustn't use the same camera. I guess you're using Camera.main in any case, that's why you have that problem. Declare the variable mainCamera and minimapCamera (or whatever), assign them the proper references and test if the minimap's rect contains the mouse.
i catch main.camera a.k.a "$$anonymous$$ain Camera" and save to Camera variable, then i save to othercamera a.k.a "$$anonymous$$inimap Camera" to other Camera variable, its not working, while im clicking on $$anonymous$$imapCam, its affect to main.camera too?
anyone can help how to ignore raycast from main.camera while raycast using other cam?
Your answer
![](https://koobas.hobune.stream/wayback/20220613071928im_/https://answers.unity.com/themes/thub/images/avi.jpg)