picking objects in AR

May 12, 2011 at 1:54 PM

I have tried making some of my objects selectable in my application, but i dont get any result when i click something.

The steps i've taken:

  1. create a scene
  2. add physics engine to the scene
  3. setup marker tracking
  4. add groundmarker node.
  5. create a transformation container with a scale (0.015 as my object i huge)
  6. import several objects from an fbx file.
  7. for some nodes i made them pickable, made their physics.shape either box or convexhull and set the .AddToPhysicsEngine value on true (some do not need to be pickable)
  8. then i added them to the transformation container
  9. and add the container to the groundmarker node.
  10. the source for the pick handler is equal to that of the sample in tutorials.

But when i click anywhere in the scene, i always get the text nothing selected in the upper left corner. The list of selected objects also has 0 elements (so the message is correct).

Could the problem be that objects are in a transNode, which is on a markerNode? Or could there be a problem with my alghorithm with creating a camera somewhere earlier (did something nifty to show a dialog box when there are several camera's attached.)

Coordinator
Jun 1, 2011 at 2:38 AM

When you move the markers, the objects added to the physics world do not move (which is by design). So to make the clicking work correctly, you will need to multiply your State.ViewMatrix with the markerNode.WorldTransformation for the Unproject method (when getting the near and far point for the ray casting). 

Ohan

Coordinator
Jun 1, 2011 at 2:38 AM

See ARDomino project under projects/ which does very similar thing.

Ohan

Sep 25, 2012 at 8:02 AM

Dear fjhamming!

I've got the same problem, i think the scaling causes the problem...