Reputation: 194
I'm using wpf and viewport 3d. Now I can show a cube (as ModelsGroup: two meshes per one cube side, because each of cubes site has own color). I want to detect, when user hits a cube edge using mouse click. I know it could be done with Visual Tree Helper, but I must do it with some tolerance. How can I detect hit, if user clicks the point close to edge, but that point is outside mesh?
Upvotes: 1
Views: 100
Reputation: 54781
Could adjust the x and y of the press point and test several locations. Many cubes may be hit, that's then up to you how to resolve that.
i.e. could test a pattern of 9:
t
is tolerance, x,y
are the coords of the click point
x, y
x + t, y
x - t, y
x, y + t
x, y - t
x + t, y + t
x + t, y - t
x - t, y + t
x - t, y - t
Upvotes: 1