Problem with getting name of spatial

Alright, I have made "Hello_mouspick" tutorial, everything works as it should.

But I've wanted to get name of spatial "hit" by ray, how am I suppose to do it?

I've tried this:


where "pr" is PickResults variable.

Each time I click something in scene I get null value of that system.out ^
Any idea how to solve this?

Thanks for help guys, you're really great!

your spatial might have children with names like "regroup03" or "temp0"

Try getting the target meshes parent object…


for (int i = 0; i < pr.getNumber(); i++) {

That is bigger part of the code, I tried getParentGeom() but all I get is "temp0" :s

Take a look at your scenegraph by using this tool:

Maybe it all makes sense then.

Well that code up there is responsible for changing colour of selected object, I want it to return it's name as soon as I click it, however it returns same value "temp0" for every possible object in scene I click :s

@Hevee, thanks, I'll check it out later :slight_smile:

(please mark correct answer)

[ ] all your spatials are named "temp0"

[ ] the spatial named "temp0" is returned every time. you checked it in a debugger. the reason is that you're firing the ray from inside a spatial called "temp0", so it's always the first hit

[ ] other