Scene |
public RayHitTestResult? GetClosestHitObject( Ray ray, HitTestOptions? customHitTestOptions = null )
GetClosestHitObject method executes a hit testing on the SceneNodes that are shown by this SceneView and returns a RayHitTestResult object with the closest triangle hit. When no triangle is hit, null is returned.
This method takes a Ray as a parameter. The ray can be created by the GetRayFromCamera(Single, Single, Boolean, Boolean) or GetRayFromNearPlane(Single, Single, Boolean, Boolean) methods. You can also use the [!:GetClosestHitObject(float, float, bool)] method that takes mouse coordinates instead of a Ray.
To control advanced hit-testing options set the customHitTestOptions parameter (HitTestOptions) or change the Scene.[!:DefaultHitTestOptions] that is used when customHitTestOptions parameter is not set (null by default).
To get all hit results (ant not just the closest hit), use the [!:GetAllHitObjects(float, float, bool)] or [!:GetAllHitObjects(Ray)] methods.