MeshModel Get Triangle Based on X,Y Coordinate
Moderator: Queue Moderators
MeshModel Get Triangle Based on X,Y Coordinate
I was looking at the 'Mesh models coloring, wireframe' demo and its mouse over annotation feature. I'd like to be able get the triangle based on X/Y values that sit inside one of the triangles that make up the mesh. Is this possible?
-
- Posts: 558
- Joined: Mon Mar 14, 2016 9:22 am
Re: MeshModel Get Triangle Based on X,Y Coordinate
I believe User's Manual describe this in chapter 6.13.8 'Tracing the model with mouse'
MeshModel has triangle-based tracing for mouse position.
Use MouseTriangleTraced event. It will indicate the nearest triangle to camera, where the mouse hits.
The event arguments have the following info:
• IntersectionPointAxisValues: intersection point of triangle face, in axes values
• ModelSpaceTriangleCoordinates: array of 3 triangle corners (vertices) the mouse is hitting, in 3D model space coordinates
• WorldSpaceTriangleCoordinates: array of 3 triangle corners (vertices) the mouse is hitting, in 3D world space coordinates.
• NearestCoordinateIndex: Index of nearest coordinate index of traced triangle, value of 0…2. Use the index to extract the coordinate from ModelSpaceTriangleCoordinates or WorldSpaceTriangleCoordinates array.
MeshModel has triangle-based tracing for mouse position.
Use MouseTriangleTraced event. It will indicate the nearest triangle to camera, where the mouse hits.
The event arguments have the following info:
• IntersectionPointAxisValues: intersection point of triangle face, in axes values
• ModelSpaceTriangleCoordinates: array of 3 triangle corners (vertices) the mouse is hitting, in 3D model space coordinates
• WorldSpaceTriangleCoordinates: array of 3 triangle corners (vertices) the mouse is hitting, in 3D world space coordinates.
• NearestCoordinateIndex: Index of nearest coordinate index of traced triangle, value of 0…2. Use the index to extract the coordinate from ModelSpaceTriangleCoordinates or WorldSpaceTriangleCoordinates array.