Picking & identifying object...(solved)

hi, everyone. :smiley:

this is my 2nd post. :roll:

I’m implementing mouse-picking. 8)

In dynamic loading, when loading models, put theirs id(?) and it’s description into the some table.


| id | desc |
| 123 | A's house |
| 456 | B's house |

And when picking a object in the world, I can get it's id(?).
I find it in table above to get picked object's description.
In other words, check if picked object's id is equals to object's id in table.
If someone equals to picked object, can get it's description from table.
But, this is just algorithm.

In practice, two id(?)'s types(not value) are different.  :oops:

In picking, the type is PickData.
In table, the type is Node or Spatial.

I can't match them.  :cry:

What's the solution for this problem?
Any replies can help me.
(Sorry for my broken english.)


In my case every object that i can pick is attached to its own Node.

I also have a HashMap<Node, Entity> where i store the Node reference together with its Entity reference (like your Description).

Now if i pick something, i iterate its parents up to the Node and can retrieve the Entity reference from the Map.

Geometry geom = results.getPickData(i).getTargetMesh().getParentGeom();
Node node = geom.getParent();
Entity e = entityMap.get(node);

Depending on your Objects you have to call getParent() recursively to get your correct Node.

Dear core-dump.

All things are clear.

Thanks so much for your helps.