I have a 3D graphics space on which I draw and manipulate several cubes. I am trying to use pickpoint to allow the user to interactively click on the objects, and have reproduced the steps outlined in https://decibel.ni.com/content/docs/DOC-4958, which is remarkably similar to my application. Even so, pickpoint hit always returns false. Does anyone have any ideas why this could be happening, i.e. pickpoint uses a different coordinate system or is dependent on scene rotation/translation?
Solved! Go to Solution.
Are you sure you're inputting the coordiantes RELATIVE to the 3D scene display? The input values need to be pixel coordinates relative to the top-left corner of the 3d display. Then it should work, it has always worked for me.
If you see in the example you link to, they subtract the position of the 3D display from the mouse coordinates used to click on the scene.
Yes, I've checked that the coordinates being sent to the pickpoint invoke node are in pixels relative to the upper left of the scene. Screenshots of my code are below.
The subVIs here take in strings for the object and decal names as well as the object size and return the object reference.
This code is in the event structure for mouse down in the 3D scene area.
I'm at a loss as to what is going wrong.
A really stupid question: Is your 3D Scene a control or an indicator?
I've seen some wierd behaviour between controls and indicators in the past.
Otherwise it looks really like the example you linked to earlier..... Wierd.
I've actually just noticed a bug in that example. The "position" of the 3D picture includes the label. Instead, the code should use the property "Content Position" instead.
Depending on where the label is, this could yield some really wrong coordinates for the mouse click.
You can probe the value of the coordinates being input into the "PickPoint" method.
Thanks for your suggestions. Currently the 3D scene is an indicator rather than a control-does pickpoint require a control?
Also, I changed the Position to ContentPosition but since I had the label hidden on the FP anyway it didn't change the coordinates, which are still correct.
No, it doesn't require a control, I've since tested the vi at the link you provided earlier.
I don't have any other inputs, sorry.
Can you post the offending VI?
I tried to trim out the pertinent bit here from my program, so the zip file below should replicate the problem in my same scenario.
The only things I can think of would issues from A) drawing some of the child objects inside the main object (but if I zoom out and click on the parent, hit is still false) or B) applying decals to the objects (the decals here are replacements for those in my actual VI, so I can't just use solid color instead).
Main.VI will open everything up.
Thanks for looking into this.
Well, after some time playing around, I found the problem. Although it doesn't throw any errors if unwired, the PickPoint terminal must be wired to something for the invoke node to successfully find a 3D object.
Not sure why that is, but hopefully this helps someone out somewhere down the line.