Hololens/Lib/Collisions.cs
//###################################################################################################################
/// <summary>
/// Ray hit test in space from 2D coordinate of a camera field of view.
/// </summary>
/// <param name="camera"> the camera where the hit test start, UrhoSharp CullingCamera recommanded </param>
/// <param name="x"> ray position on x axis from left up corner of camera view, normalised value </param>
/// <param name="y"> ray position on y axis from left up corner of camera view, normalised value </param>
/// <returns> ray hit test information. If no collision detected is detected, return null </returns>
Ray hit test in space from 2D coordinate of a camera field of view.
Ray hit test in space from 2D coordinate of a camera field of view .
private RayQueryResult? RayHit(Camera camera, float x, float y)
        {
            Ray cameraRay = CullingCamera.GetScreenRay(x, y); 
            var result = Scene.GetComponent<Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000);
            return result;
        }
private RayQueryResult ? RayHit ( Camera camera , float x , float y ) { Ray cameraRay = CullingCamera . GetScreenRay ( x , y ) ; var result = Scene . GetComponent < Octree > ( ) . RaycastSingle ( cameraRay , RayQueryLevel . Triangle , 100 , DrawableFlags . Geometry , 0x70000000 ) ; return result ; }
Ray hit test in space from 2D coordinate of a camera field of view.
Ray hit test in space from 2D coordinate of a camera field of view .
// ray coresponding to center of field of view // hit test using the previous ray
ray hit test information. If no collision detected is detected, return null
ray hit test information . If no collision detected is detected return null
camera
Camera
the camera where the hit test start, UrhoSharp CullingCamera recommanded
the camera where the hit test start UrhoSharp CullingCamera recommanded
x
float
ray position on x axis from left up corner of camera view, normalised value
ray position on x axis from left up corner of camera view normalised value
y
float
ray position on y axis from left up corner of camera view, normalised value
ray position on y axis from left up corner of camera view normalised value