Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello; I am wondering whether the Python version of c4d.utils.ViewportSelect.PickObject() may be missing a return value.
c4d.utils.ViewportSelect.PickObject()
Within C++, I can extract the depth of the picked point with GetZ() on the returned C4DObjectList. (I didn't try this but it has been discussed before on this forum.) In Python, all I get is a Python list with no such method, and the list contains only objects, not object/zdepth pairs. The help text for the flags indicates that VIEWPORT_PICK_FLAGS_OGL_ONLY_TOPMOST_WITH_OBJ at least should give me a z value ("Picks only topmost object but returns the topmost object with its Z position.") but that may be just copied from the C++ help.
GetZ()
C4DObjectList
VIEWPORT_PICK_FLAGS_OGL_ONLY_TOPMOST_WITH_OBJ
So, while I can identify the object under a mouse click, I cannot find the depth of the hit point. Trying to get around by using other ViewportSelect methods shows that these apparently only work for polygon objects.
What is the preferred method to find an object under the mouse cursor including the z-depth of the found hit?
Thanks.
Hi @Cairyn this is currently not possible (I've added it to our list of parity list).
Regarding possible workarounds:
Cheers, Maxime.
@m_adam Oops. Okay, GeRayCollider works only for polygon objects, as does GetPixelInfoPolygon.
The idea was to provide a new selection method for arbitrary objects by just checking all hits of a scattered PickObject within a radius, and then select the nearest hit. For that, I need to be able to hit splines and parametric objects as well.
Okay, I guess I can still do that in C++ then, thanks.