LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pickpoint doesn't hit objects in 3D scene

Solved!
Go to solution
Highlighted

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!

0 Kudos
Message 1 of 10
(1,453 Views)
Highlighted

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.

0 Kudos
Message 2 of 10
(1,448 Views)
Highlighted

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.

Add objects to scene

 

This code is in the event structure for mouse down in the 3D scene area.

Mouse Down Event

I'm at a loss as to what is going wrong.

0 Kudos
Message 3 of 10
(1,439 Views)
Highlighted

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.

0 Kudos
Message 4 of 10
(1,434 Views)
Highlighted

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.

0 Kudos
Message 5 of 10
(1,433 Views)
Highlighted

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.

0 Kudos
Message 6 of 10
(1,429 Views)
Highlighted

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?

0 Kudos
Message 7 of 10
(1,424 Views)
Highlighted

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.

0 Kudos
Message 8 of 10
(1,419 Views)
Highlighted
Solution
Accepted by topic author derekemuff

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.

Message 9 of 10
(1,404 Views)
Highlighted

Well that sounds like a bug.....

0 Kudos
Message 10 of 10
(1,397 Views)