I find strange behavior with below implementation in Scene examples.The movement appears to have unexpected heading changes along the path.I have a set of points which are perfectly interpolated and are working fine in 2D animation.
public double generateBearing(double ox, double oy, double dx, double dy)
{
double bearing = 0.0;
double lon1 = ToRad(ox);
double lat1 = ToRad(oy);
double lon2 = ToRad(dx);
double lat2 = ToRad(dy);
double dLon = lon2 - lon1;
double y = Math.Sin(dLon) * Math.Cos(lat2);
double x = Math.Cos(lat1) * Math.Sin(lat2) - Math.Sin(lat1) * Math.Cos(lat2) * Math.Cos(dLon);
double bRad = Math.Atan2(y, x);
double tmpB = ToDegrees(bRad);
//bearing =360.0-(tmpB+270.0)%360.0;
bearing = tmpB;
return bearing;
}
private void CreateAnimationViewpoints()
{
_animationViewpoints = new List<Camera>();
Array.Reverse(x);
Array.Reverse(y);
heading = new double[nPointCount];
for (int i = 0; i < nPointCount-1; i++)
{
heading=generateBearing(x, y, x[i + 1], y[i + 1]);
// heading = getBearing(x, y, x[i + 1], y[i + 1]);
_animationViewpoints.Add(new Camera(new MapPoint(x, y, 50), heading, 70));
}
}
private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e)
{
MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged;
try
{
for (int i = 0; i < nPointCount; i++)
{
await MySceneView.SetViewAsync(_animationViewpoints, 1, false);
}
// Set navigation in the order we want to animate the camera
}
catch (Exception ex)
{
MessageBox.Show("Error occured while navigating to the target viewpoint",
"An error occured");
Debug.WriteLine(ex.ToString());
}
}
Hi Durga,
In a previous life I was a .NET programmer, and this code looks very familiar!
Have you also posted this question to our .NET forum? This one here is specific to Android.
Thanks!
Could you provide a bit more details and/or full reproducible application to demonstrate the issue?