You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
To cast a ray, one should get TouchEndEventArgs X and Y and divide them by Graphics.Width and Graphics.Height.
But TouchEndEventArgs uses the whole screen, including the 40 pixels height black banner on top of the screen while Graphics.Height does not.
So one should make a correction to TouchEndEventArgs.Y before the ray cast:
private uint? StarIndex(TouchEndEventArgs e, int x, int y)
{
{
//The correction to make because of the 40 pixels height Black Banner on top of the screen
float ey = ((float)(e.Y + y) - 40f) * (float)Graphics.Height / ((float)Graphics.Height - 40f) ;
Ray cameraRay = camera.GetScreenRay((float)(e.X + x) / Graphics.Width, (float)ey / Graphics.Height);
RayQueryResult? result = octree.RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry);
if (result != null)
{
return result.Value.SubObject;
}
}
return null;
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
To cast a ray, one should get TouchEndEventArgs X and Y and divide them by Graphics.Width and Graphics.Height.
But TouchEndEventArgs uses the whole screen, including the 40 pixels height black banner on top of the screen while Graphics.Height does not.
So one should make a correction to TouchEndEventArgs.Y before the ray cast:
The text was updated successfully, but these errors were encountered: