Topic: Drag 3D Marker

Hi,

Can I drag a 3D Marker?

Thanks!

Re: Drag 3D Marker

Hello.

Yes.
http://infinity-code.com/doxygen/online … bba1a6a5f6

Kind Regards,
Infinity Code Team.

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

Re: Drag 3D Marker

Thanks for replying.

I tried with 2D marker and I'm able to do a long press and drag, however, I'm not able to press and hold and drag the 3D marker.
I created a prefab and added it on my map. I set the marker to SetDraggable and subscribed to OnLongPress and OnDrag events. Kind of using the same method as your example. Are there more stuffs that I need to do?

Re: Drag 3D Marker

I have not seen your code, and it is difficult for me to say what is wrong.

I created a simple test script and it works correctly.

using UnityEngine;

public class TestDrag3DMarker : MonoBehaviour
{
    private void Start()
    {
        double lng, lat;
        OnlineMaps.instance.GetPosition(out lng, out lat);
        OnlineMapsMarker3D marker3D = OnlineMapsMarker3DManager.CreateItem(lng, lat, null);
        marker3D.scale = 50;
        marker3D.SetDraggable();
    }
}
Kind Regards,
Infinity Code Team.

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

Re: Drag 3D Marker

Alex Vertax wrote:

I have not seen your code, and it is difficult for me to say what is wrong.

I created a simple test script and it works correctly.

using UnityEngine;

public class TestDrag3DMarker : MonoBehaviour
{
    private void Start()
    {
        double lng, lat;
        OnlineMaps.instance.GetPosition(out lng, out lat);
        OnlineMapsMarker3D marker3D = OnlineMapsMarker3DManager.CreateItem(lng, lat, null);
        marker3D.scale = 50;
        marker3D.SetDraggable();
    }
}

Not sure if there is something wrong with my prefab... User will select and assign texture to the sprite renderer at runtime...

Post's attachments

Attachment icon MyImage.prefab 3.23 kb, 81 downloads since 2019-07-18 

Re: Drag 3D Marker

Actually the problem is in your prefab.
1. UI element cannot be 3D marker.
2. SpriteRenderer does not need to be UI element.
3. When using SpriteRenderer, you need to manually add and configure BoxCollider.

I made a video of how to create a SpriteRenderer marker:
https://www.dropbox.com/s/m67ltm1868pjl … r.mp4?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: Drag 3D Marker

Alex Vertax wrote:

Actually the problem is in your prefab.
1. UI element cannot be 3D marker.
2. SpriteRenderer does not need to be UI element.
3. When using SpriteRenderer, you need to manually add and configure BoxCollider.

I made a video of how to create a SpriteRenderer marker:
https://www.dropbox.com/s/m67ltm1868pjl … r.mp4?dl=0

Thanks for your video.
Managed to get it working. One last question, once we set the marker to be draggable, how do I turn it off?

Re: Drag 3D Marker

If you want the marker to be optional draggable, you need to implement it yourself.

marker.OnPress += OnMarkerPress;

private void OnMarkerPress(OnlineMapsMarkerBase marker)
{
    if (condition) OnlineMapsControlBase.instance.dragMarker = this;
}

P.S. Using this way, you do not need to use SetDraggable.

Kind Regards,
Infinity Code Team.

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