1 (edited by 2duaneg 2020-08-13 00:51:41)

Topic: Custom map overlay in a specific region

I would like create my own map and overlay it in specific region, like a single shipping port or waterway. I have attached a rough example of what type of map overlays I would like to do. The lines and poly lines will be too simplistic for what I have to do. I need to use a specific nautical chart, and show separate layers for restricted areas, shipping lanes, currents, etc. What I need is something like the "Tileset Overlay Example". However, from what I can tell, this example only puts an overlay over the entire world map. I know that I could create a global map with alpha so only the parts I want show up, but I would have to sacrifice resolution, so that does not seem practical. Please advise on how I can overlay a png or other file that supports alpha over a specific region. Once in place, it will also need to move and zoom in and out with the map.

All the best.

Post's attachments

Attachment icon mapoverlyexample.png 522.59 kb, 61 downloads since 2020-08-13 

Re: Custom map overlay in a specific region

Hello.

Example:
https://forum.infinity-code.com/viewtop … 6549#p6549

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Custom map overlay in a specific region

Thanks Alex. This is perfect ... just what I was looking for.

4 (edited by 2duaneg 2020-08-13 16:42:27)

Re: Custom map overlay in a specific region

As I started working with this script, I ran into a few issues. I am working with maps in a VR simulation environment. At first the overlays were noticeably above the map. I was able to fix that by adding some code to offset the y position value of the overlay container. However, as I try to rotate the chart, the overlay does not rotate with it. The attached image shows the overlay container x rotation value of -40. That value matches what I set the map to, but as you can see, the overlay is still flat. Also,I tried manually rotating the container during run time, but as I move map, the overlay does not stay aligned. Is there a way I can fix this?

All the best.

Post's attachments

Attachment icon OverlayChartRotated.PNG 478.13 kb, 69 downloads since 2020-08-13 

Re: Custom map overlay in a specific region

I made the necessary changes and now the script will work correctly when the map is rotated.
I updated the script in the same post where it was originally published so as not to spawn entities.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Custom map overlay in a specific region

Can you provide a link to that post? I followed the link that you previously sent to me, and there is no difference in the script.

All the best.

Re: Custom map overlay in a specific region

https://forum.infinity-code.com/viewtop … 6549#p6549
I just checked and the post contains the correct version of the script.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Custom map overlay in a specific region

The map with overlay is working well except that I am also using the OnlineMapsDrawingLine to show routes. However, the lines do not show on my overlay map, only on the base map. How can I fix this?

Re: Custom map overlay in a specific region

To fix this get a Drawing container (Map / Drawing), and move it up a little (Y-axis).

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Custom map overlay in a specific region

My apologies, I should have mentioned before that I had tried that. The issue is that I had to raise the line way above the map before it would render. I have attached a screen shot that shows the line raised above the map. Notice that the line is not rendering when it is over the overlay, but is rendering where it is not viewed over the overlay.

Post's attachments

Attachment icon ChartLineOverlay.PNG 97.11 kb, 52 downloads since 2020-08-21 

Re: Custom map overlay in a specific region

I updated the script in the link above and added a field for the shader.
Set Tileset or Tileset Cutout shader in this field.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Custom map overlay in a specific region

With the latest revision the Alpha setting does not work. I am assuming this has to do with the Shader.
Also, how can I add multiple layers? I would like to use my custom map as the base layer, and then add other layers to it. I will then use buttons to turn the various layers on and off.

Re: Custom map overlay in a specific region

Alpha works well.
Just Tileset Cutout shader does not support transparency.
If you need alpha, use Tileset shader instead.

To do multiple overlays, add multiple instances of this script.
Use Material.renderQueue to control the drawing order of overlays.
https://docs.unity3d.com/ScriptReferenc … Queue.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.