Alexey Vanzhula Posted January 21, 2018 Share Posted January 21, 2018 (edited) Hi. I want to find closest point to mouse pointer. It's not a problem when the mouse pointer intersects with a surface. But how to get the point if it is outside the surface? I have the pointer origin and direction https://s9.postimg.org/a8y8r58i7/image.png Edited January 21, 2018 by Alexey Vanzhula Quote Link to comment Share on other sites More sharing options...
f1480187 Posted January 21, 2018 Share Posted January 21, 2018 If the origin is a proper 3D point with depth already accounted for, this should be relatively easy: origin = (1, 1.2, 0) op = hou.pwd().inputs()[0].path() expr = 'nearpoint("{}", {}, {}, {})'.format(op, *origin) pt = int(hou.hscriptExpression(expr)) 1 Quote Link to comment Share on other sites More sharing options...
Alexey Vanzhula Posted January 22, 2018 Author Share Posted January 22, 2018 6 hours ago, f1480187 said: If the origin is a proper 3D point with depth already accounted for, this should be relatively easy: origin = (1, 1.2, 0) op = hou.pwd().inputs()[0].path() expr = 'nearpoint("{}", {}, {}, {})'.format(op, *origin) pt = int(hou.hscriptExpression(expr)) The problem is how to find the depth in the "air" . When the line (from ray and origin) intersects with the surface it is not a problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.