08-08-2014 08:40 AM
Hi all,
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?
Thanks!
Solved! Go to Solution.
08-08-2014 08:58 AM
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.
08-08-2014 09:53 AM
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.
08-08-2014 10:03 AM
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.
08-08-2014 10:07 AM - edited 08-08-2014 10:08 AM
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.
08-08-2014 10:18 AM
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.
08-08-2014 10:34 AM
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?
08-08-2014 11:08 AM
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.
08-08-2014 02:42 PM
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.
08-08-2014 03:24 PM
Well that sounds like a bug.....