move object by clicking on mini map
Making Android game and added a mini map. The game itself is a fixed camera with a smooth lookat the character. So, fine while moving the character in the game camera view port, but to move character long distances or BEHIND the current game camera view port, I would like the user to be able to click on the mini map the location they want the player to go. Not sure where to even start. I have the walls in the scene - and everything but the floor - on the Ignore raycast layer so clicking on the mini map won't try to send the character to climb a wall...but how to translate the Vector3 location on the mini map to the location in the game view port? Do I add another raycaster to the mini map camera?
Answer by shadowpuppet · Oct 08, 2019 at 08:03 PM
yes I found this but not sure it applies or I don't get it https://answers.unity.com/questions/517082/minimap-clicking-rts-style-feature.html
how embarrassingly easy.......same script I have on the floor in the scene I use on the $$anonymous$$i map floor ( different layer an unseen in main camera) and just make a reference and change one section.
public Camera $$anonymous$$i;
void Update(){
if (Input.Get$$anonymous$$ouseButtonDown(0)){
Ray ray = $$anonymous$$i.ScreenPointToRay(Input.mousePosition);
////was - in main cam script... Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Yes. The logic is the same as clicking on your main floor. Just change your ray target layer.
Glad you made it yourself.
this forum seems to always work as "rubber duck debugging" for me..once I find the words to describe my issue as simply as I can and explain it - it clears the cobwebs in my head and I usually figure it after clearly defining the issue .
Your answer
Follow this Question
Related Questions
Navigation conventions for touch input 0 Answers
How to create car ai that moves around searching for player 0 Answers
navigation takes too high cpu usage 0 Answers
Android Status and Navigation bars appears in fullscreen after blocking the screen. 0 Answers
Click to move NavMeshAgent Script not working... please help! 1 Answer