Skip to content

Instantly share code, notes, and snippets.

@mfkl
Created April 7, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfkl/189cba32b4863bf1289a79444f352053 to your computer and use it in GitHub Desktop.
Save mfkl/189cba32b4863bf1289a79444f352053 to your computer and use it in GitHub Desktop.
void PanUpdated(object sender, PanUpdatedEventArgs e)
{
switch (e.StatusType)
{
case GestureStatus.Running:
if (ScreenWidth > 0 && ScreenHeight > 0)
{
double range = Math.Max(ScreenWidth, ScreenHeight);
float yaw = (float)(Fov * -e.TotalX / range);// up/down
float pitch = (float)(Fov * -e.TotalY / range);// left/right
MediaPlayer.UpdateViewpoint(Yaw + yaw, Pitch + pitch, Roll, Fov);
}
break;
case GestureStatus.Started:
case GestureStatus.Canceled:
break;
case GestureStatus.Completed:
Fov = MediaPlayer.Viewpoint.Fov;
Pitch = MediaPlayer.Viewpoint.Pitch;
Roll = MediaPlayer.Viewpoint.Roll;
Yaw = MediaPlayer.Viewpoint.Yaw;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment