|
TriangleMeshTHitTest Method |
HitTest method test the triangles defined in this mesh for hitting with the specified ray.
When getOnlyNextHitTest is false, then the closest hit result is returned, else the next hit result is returned.
When no hit is found, null is returned.
Namespace: Ab4d.SharpEngine.MeshesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax public RayHitTestResult? HitTest(
ref Ray localRay,
HitTestContext hitTestContext,
int startTriangleIndex,
bool getOnlyNextHitTest,
bool throwExceptionWhenUnsupported = false
)
Parameters
- localRay Ray
- SharpDX.Ray in local SceneNode coordinate system
- hitTestContext HitTestContext
- DXHitTestContext
- startTriangleIndex Int32
- triangle index where to start looking for hit. Note that this is not an index in the triangle indices array (index buffer) but triangle index - index in triangle indices array is get by multiplying this value by 3.
- getOnlyNextHitTest Boolean
- When getOnlyNextHitTest is false, then the closest hit result is returned, else the next hit result is returned.
- throwExceptionWhenUnsupported Boolean (Optional)
- when true an exception is thrown in case an unsupported vertex buffer type is used (supported types: PositionNormalTexture, PositionNormal, PositionTexture, Vector3). Default value is false.
Return Value
RayHitTestResultDXRayHitTestResult when hit is found or null when no hit is found
Remarks
HitTest method test the triangles defined in this mesh for hitting with the specified ray.
When getOnlyNextHitTest is false, then the closest hit result is returned, else the next hit result is returned.
When no hit is found, null is returned.
SimpleMesh can be created with any type of vertex buffer.
The HitTest method support only vertex buffer arrays with the following types:
PositionNormalTexture
PositionNormal
PositionTexture
Vector3
In case of those type this method will call the appropriate method in the HitTester class.
Other types will always return null or throw a NotSupportedException when throwExceptionWhenUnsupported parameter is true (false by default).
See Also