Jump to content

Get point near the mouse cursor


Alexey Vanzhula

Recommended Posts

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 by Alexey Vanzhula
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...