Topic: Manage height of 3D Marker

Hello,

How can I manage the height of 3d marker? the poisition of the marker is only set by latitude and longitude.
Could you please indicate me the good way to manage the height. I wouldn't make bad modification on the 3d marker code.

Thanks you.

Re: Manage height of 3D Marker

Hello.

You ask about the marker elevation, right?
There are many ways to do it.

OnlineMapsTileSetControl.GetElevationValue
http://infinity-code.com/doxygen/online … dca7e4a852

OnlineMapsGetElevation.Find
http://infinity-code.com/doxygen/online … 1b2ee59c64

One more way in «Aircraft.cs».

Kind Regards,
Infinity Code Team.

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

Re: Manage height of 3D Marker

Yes i'm asking about elevation of 3d marker.
To instantiate a 3d marker I use :

Vector2 markerPosition = new Vector2(x,y);
marker3D = control.AddMarker3D(markerPosition, marker);

So I use the couple latitude/longitude to instatiante the marker.
I would like to be able to also set the elevation.

Is OnlineMapsTileSetControl the right way?

Thank you.

Re: Manage height of 3D Marker

Example:

Vector3 pos = marker3D.instance.transform.position;
Vector2 topLeftPosition = OnlineMaps.instance.topLeftPosition;
Vector2 bottomRightPosition = OnlineMaps.instance.bottomRightPosition;
pos.y = markerAltitude * OnlineMapsTileSetControl.instance.GetBestElevationYScale(topLeftPosition, bottomRightPosition) * OnlineMapsTileSetControl.instance.elevationScale;
marker3D.instance.transform.position = pos;
Kind Regards,
Infinity Code Team.

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

Re: Manage height of 3D Marker

Thank you for you answer.
I tried your example but my marker y position stay at 0.
Even if I tried to increase it manually in the inspector it always return to 0.

Re: Manage height of 3D Marker

First of all, make sure you use «Use Elevation - ON».
If the problem persists, please attach your script, I'll check it.

Kind Regards,
Infinity Code Team.

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

Re: Manage height of 3D Marker

Use elevation is enabled.
Here is my code :

Vector2 markerPosition = new Vector2(x,y);
marker3D = control.AddMarker3D(markerPosition, marker);
float originalScale = 1 << defaultZoom;
float currentScale = 1 << OnlineMaps.instance.zoom;
marker3D.scale = currentScale / originalScale;
Vector3 pos = marker3D.instance.transform.position;
Vector2 topLeftPosition = OnlineMaps.instance.topLeftPosition;
Vector2 bottomRightPosition = OnlineMaps.instance.bottomRightPosition;
pos.y = 8 * OnlineMapsTileSetControl.instance.GetBestElevationYScale(topLeftPosition, bottomRightPosition) * OnlineMapsTileSetControl.instance.elevationScale;
marker3D.instance.transform.position = pos;

If I Debug.Log(pos) I get a non null value for pos.y but in the inspector the y value stay to 0.

Thanks again.

Re: Manage height of 3D Marker

The script and the screenshot attached.

Post's attachments

Attachment icon img1.png 793.88 kb, 104 downloads since 2016-01-18 

Attachment icon Marker3D_SetAltitude.cs 1.71 kb, 179 downloads since 2016-01-18 

Kind Regards,
Infinity Code Team.

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

Re: Manage height of 3D Marker

Thank you it works great.
But is there a way to manage the elevation on Start and not on LateUpdate ?

When I put the code on late Update the elevation is set at each frame and it works.
But If I try to set the elevation juste once on Start it doesn't work (the elevation is set but it's automatically reset to 0 at each frame.

Thank you in advance

Re: Manage height of 3D Marker

Hello.

In «Start» it will always be zero, because Online Maps need to get data from Bing Maps Elevation API, and it takes time.
This script uses «LateUpdate» to prevent problems with the script execution order.
Theoretically it can be that this script executed earlier than control, and will be calculated elevation data for the previous frame.
To use it in «Update», set up «Edit / Project Settings / Script Execution Order».

Kind Regards,
Infinity Code Team.

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