intrinsic-179 Test3DHit |
Top Previous Next |
179: boolean:= Test3DHit(X, Y, @Handle, @TriIndex);
This intrinsic is used to test if a 3D mesh is under a specific screen location. If a mesh is found under the specified screen location, the program returns the handle for the mesh. It also returns the index to the specific triangle in the mesh that is intersected by the point.
Result. The intrinsic returns an integer Boolean that indicates whether there is a 3D Object under the X, Y coordinate.
Arguments:
X, Y. These are integer values that specify the screen position to be tested. They are the pixel position from the upper-left corner of the 3D Viewer as set by the Set3DWindow intrinsic. If you use the GetMouseState to get a position to test, remember that it returns the mouse position relative to the upper-left corner of the whole VGA screen, not the 3D Viewer. To translate this position to Viewer coordinates, you will need to subtract the Left and Top position of the 3D Viewer.
Handle. This argument is an integer handle created by the Add3DObject intrinsic. The Handle variable returns the handle for the topmost 3D mesh under the X, Y position. Since this result is returned by reference, you must pass a pointer to the intrinsic by using "@" operator. For example:
Hit:=Test3DHit(X,Y,@Handle,@Inx);
TriIndex. This integer variable returns the Index of the triangle at the X, Y location. Since this result is returned by reference, you must pass a pointer to the intrinsic by using "@" operator. See the example above. |