1 (edited by lexamv 2024-02-22 18:48:56)

Topic: Adding a filled circle under the marker

Hello, we are finishing an old project that uses Online Maps
and we were faced with one problem that was probably simply too difficult for us. We need to draw a circle with a given radius around the marker, say 75 meters, and so that when scaling it would always be 75 m.

We found a good script that seems to work well, but it doesn't paint the area inside. Maybe we should take it as a basis and simply leave the painted area without a frame but with a precise radius with the ability to set the texture for coloring.

Post's attachments

Attachment icon BouncingCircle.cs 5.39 kb, 12 downloads since 2024-02-22 

Re: Adding a filled circle under the marker

Hello.

This issue is described first in the Troubleshooting /Known issues section of the documentation.
Quote:

Drawing API - polygon has no fill in "Tileset"
This problem is related to the very difficult polygon triangulation. Most likely, this problem will never be
solved.
How to work around the problem:
1. OnlineMapsDrawingElement.checkMapBoundaries = false.
This mode works correctly only if the lines do not intersect.
2. Use "Draw to Texture" mode.
3. (Not recommended) Use Drawing as Overlay.

I can add a few more ways:
4. Use a 3D marker that looks like a circle, with Size Type - Meters, and the desired size.
5. Use a custom shader to draw the circle.
This will only work if you only need one circle.
Somewhere on the forum a user posted his implementation.
If you really need it I will try to find it.

Kind Regards,
Infinity Code Team.

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

Re: Adding a filled circle under the marker

Really need!!! Please find this.

Re: Adding a filled circle under the marker

I couldn't find this, so I created new ones (attached).
Select the shader in Tileset / Materials & Shaders / Tileset Shader, and add the component to the GameObject.

Post's attachments

Attachment icon TilesetWithCircle.cs 1.58 kb, 23 downloads since 2024-02-23 

Attachment icon TilesetWithCircle.shader 1.52 kb, 20 downloads since 2024-02-23 

Kind Regards,
Infinity Code Team.

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

Re: Adding a filled circle under the marker

something is not working, can you help and demonstrate how it should work?

Re: Adding a filled circle under the marker

Sure, here's the video:
https://www.dropbox.com/scl/fi/ei97234j … 3&dl=0

Kind Regards,
Infinity Code Team.

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

Re: Adding a filled circle under the marker

Thank you, it works great, but we applied the shader to the meshrender of the object by adding materials, so problems arose.

Re: Adding a filled circle under the marker

Can you please tell me will this work for just one object on the map or can it be done on several at the same time?

Re: Adding a filled circle under the marker

The current implementation of the script and shader can only work with a single object.
You can improve it by modifying the script and shader for Vector Array, in which case it can work with any number of objects.
https://docs.unity3d.com/ScriptReferenc … Array.html

Kind Regards,
Infinity Code Team.

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

10 (edited by lexamv 2024-03-03 11:50:58)

Re: Adding a filled circle under the marker

Hello. Thanks for your work. Everything works great, but it doesn’t work with Shader.SetGlobalVectorArray. Not enough experience. We went the other way and decided to press an object that contains the material to the 3D marker and draw a simple circle of the desired color. We went and simply found 100 meters on the map, set a circle and tried to recalculate the scale taking into account the changes on the map. We calculate the coefficient and apply it to the object. Maybe you can tell us what the problem is?

https://www.dropbox.com/scl/fi/m44powv6 … 0&dl=0

Post's attachments

Attachment icon Circle.shader 1.85 kb, 9 downloads since 2024-03-03 

Re: Adding a filled circle under the marker

An example of how to modify the script and shader for Vector Array is attached.

Unfortunately, I didn't understand your explanation about 3D markers.
If this problem is still relevant, please try to explain it in more detail.

Post's attachments

Attachment icon TilesetWithCircle.cs 1.92 kb, 12 downloads since 2024-03-03 

Attachment icon TilesetWithCircle.shader 1.78 kb, 12 downloads since 2024-03-03 

Kind Regards,
Infinity Code Team.

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

Re: Adding a filled circle under the marker

GREAT!!! Could you be asked to modify it so that you could set the color of each circle?

Re: Adding a filled circle under the marker

Try it yourself first.
It's very easy.
Just create another array of colours.

Kind Regards,
Infinity Code Team.

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

Re: Adding a filled circle under the marker

yes everything worked out