Click or drag to resize
AB4D logo

DXSceneGetClosestHitObject Method

GetClosestHitObject method executes a hit testing on the SceneNodes in this DXScene (or when specified on rootSceneNode and its children) and returns a DXRayHitTestResult object with the closest triangle hit by the specified ray. When no triangle is hit, null is returned.

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.0.8865.1045
Syntax
C#
public DXRayHitTestResult GetClosestHitObject(
	Ray ray,
	SceneNode rootSceneNode = null
)

Parameters

ray  Ray
SharpDX.Ray object that defines the ray that is used for hit testing
rootSceneNode  SceneNode  (Optional)
SceneNode where the hit testing begins and continues to SceneNode's children. When not set or null, then DXScene.RootNode is used (optional)

Return Value

DXRayHitTestResult
DXRayHitTestResult with the closest hit object or null if no object was hit
Remarks

HitTest method executes a hit testing on the SceneNodes in this DXScene (or when specified on rootSceneNode and its children) and returns DXRayHitTestResult object with the closest triangle hit by the specified ray. When no triangle is hit, null is returned.

It is possible to adjust hit testing with changing the value in the DXHitTestOptions property.

To get all hit results, use the GetAllHitObjects(Ray, SceneNode) method.

See Also