 |
HitTesterHitTest(Ray, Vector3, Int32, Boolean, Int32, Boolean, Single) Method |
Hit test a ray against the mesh with specified vertex and index buffer.
Namespace: Ab4d.SharpEngine.UtilitiesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.0.9584+ba1aaa26d4181dd3fa8ed7b6398391d1affa36c8
Syntaxpublic static RayHitTestResult? HitTest(
Ray localRay,
Vector3[]? positionsArray,
int[]? indexBufferArray,
bool hitOnlyFrontFacingTriangles,
int startTriangleIndex,
bool getOnlyNextHitTest,
float zeroTolerance = 1E-07f
)
Parameters
- localRay Ray
- ray transformed to local coordinate system
- positionsArray Vector3
- vertex buffer as array of Vector3
- indexBufferArray Int32
- index buffer
- hitOnlyFrontFacingTriangles Boolean
- When true then only triangles that have normals (calculated from triangle positions) oriented in the opposite direction as the ray are returned (because ray is usually created from the camera's position this returns only triangles that are facing the camera).
- startTriangleIndex Int32
- index of the triangle where the hit testing will begin - triangle indice index is get by multiplying this number by 3
- getOnlyNextHitTest Boolean
- when true, then the next hit result is returned; when false all hit results are get and only the closest to the ray origin is returned.
- zeroTolerance Single (Optional)
- optional float that defines the zero tolerance - if value is smaller that this value, then it is considered zero. It is recommended that this value is based on the mesh's size. Default value is 1e-7.
Return Value
RayHitTestResultRayHitTestResult when ray hits the mesh otherwise null is returned
See Also