 |
WorldColorInstanceDataGetHitInstanceIndex Method |
GetHitInstanceIndex returns index of the instance that was hit in hit testing (defined by hitBounds).
The method returns -1 if hitBounds is not found (was not hit).
Namespace: Ab4d.SharpEngine.CommonAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.1.9680+a1b1e43de1ad9a7e35472c33948d688d7b40ef79
Syntaxpublic static int GetHitInstanceIndex(
BoundingBox hitBounds,
BoundingBox instancedMeshBounds,
WorldColorInstanceData[] instanceData,
bool useOnlyMatrixTranslation = false
)
Parameters
- hitBounds BoundingBox
- BoundingBox that defines the bounds of the hit model
- instancedMeshBounds BoundingBox
- BoundingBox that defines the bounds of the Mesh that was used in object instancing
- instanceData WorldColorInstanceData
- array of InstanceData
- useOnlyMatrixTranslation Boolean (Optional)
- true if World matrices in instanceData define only translation (OffsetX, OffsetY, OffsetZ) and no scale or rotation (in this case a faster code path can be taken); if false (by default) a full matrix transformation is executed on each position
Return Value
Int32index of the instance that was hit or -1 if no instance is hit
Remarks
The following code shows a method that changes the color of the instance with mouse over it.
See Also