Can get Point-Index under the mouse pointer? (Py)
I found a useful post.
But I'm a beginner so I'm asking for help. Thank you.
1. Python SDK
2. GetNearestPoint to work
Can get Point-Index under the mouse pointer? (Py)
I found a useful post.
But I'm a beginner so I'm asking for help. Thank you.
1. Python SDK
2. GetNearestPoint to work
Hello @ymoon,
Thank you for reaching out to us. I am a bit confused regarding what you are asking for here. The method ViewportSelect.GetNearestPoint
you have linked to is indeed the recommended way to retrieve the closest vertex to a mouse cursor. Its return value also contains the index of the closest element under the key i.
Alternatively, you could also convert the points of a point object first to world and then to screen space using BaseView.WS. You could then manually poll the mouse using c4d.gui.GetInputEvent or use mouse coordinates provided by another method to determine which is the closest point. But since this is extra labor and the kind of computation one wants to avoid doing in Python for performance reasons, you should only do that if you must customize the closest point computation for some reason.
Cheers,
Ferdinand
MAXON SDK Specialist
developers.maxon.net