CollisionResults limited to node depth

Hello,



can it be that the CollisionResults is limited to a specific node depth?

The TestMousePick example works. If I create a scene with

rootNode–>SceneNode–>Geometry



my Geometry is not picked although rootNode is set as root but



rootNode–>Geometry



is hit.

Does CollisionResults not perform down search?



Thanks.



Regards,

Equi

Hello,



It seems as if geometries which are attached to a node are not transformed in respect to the node for picking results. So if the local rotation of the node is not equal to zero (let’s say z-rot =45) and a geometry is attached to this node, it will not be hit correctly.



Could this be?



Thanks.



Regards,

Equi

Can you please provide a test case that shows the issue?

Hello,



before I provide a test case, I have to check if I understand the problem correctly. I do not want to bother you with unnecessary things. It would help me if you could comment on following statement



sceneNodeA–>sceneNodeB–>sceneNodeC–>Geometry



[java]



CollisionResults myResults= new CollisionResults();

sceneNodeA.collideWith(myRay,myResults);



[/java]



would this be okay, i.e. that I start the collideWith method from a very high sceneNodeA or does it have to be





[java]



CollisionResults myResults= new CollisionResults();

sceneNodeC.collideWith(myRay,myResults);



[/java]



i.e., the sceneNode directly above the geometry I want to test?



Thanks.



Regards,

Equi

Hello!



Hope I’m not giving false information, but I’m almost certain you can call a collideWith from anywhere on the scenegraph. You could even call rootNode.collideWith(…) and you should be fine (assuming you don’t have something in the tree that it can’t call collideWith on! :smiley: (non-Mesh)).



Though, I wouldn’t recommend it. Since if your scenegraph was big… Yeah, that collideWith would suck some performance :stuck_out_tongue:



~FlaH

Hello,



yes indeed. That is what I supposed. However, I looked at the source code and searched for a recursive pattern. Couldn’t find one. Perhaps I just didn’t look carefully enough.



Does someone know if the collideWith only works with triangle meshes? Triangle always means a plane. If I use a Lines mesh for example, I suppose that it will not work.



Thanks.



Regards,

Equi

Hello,



now I got a message…



Update exception. Only ‘Triangles’ mesh mode is supported.

[Ljava.lang.StackTraceElement;@a38abd



This tells me that only meshes with triangles can be picked.



I explicitly added



[java]myMesh.setMode(Mesh.Mode.Triangles);[/java]



although my mesh has already been displayed correctly before. But it still dos not work. No the error is not returned but me result’s size is still 0.



Regards,

Equi

Hello,



OK. Now I have figured out a little bit more whats wrong…



sceneNodeA–>sceneNodeB–>Geometry



picking does not work. I move Geometry



sceneNodeA–>Geometry



picking works, I move Geometry



sceneNodeA–>sceneNodeB–>Geometry



picking works.continuously without any problems.



So, there must happen something when attaching (or moving) the geometry between nodes.



Thanks.



Regards,

Equi

Maybe there is a problem indeed, can you post a test case then?

To answer your previous question, yes the collideWith call is recursive, here it is:

[java]public int collideWith(Collidable other, CollisionResults results){

int total = 0;

for (Spatial child : children){

total += child.collideWith(other, results);

}

return total;

}[/java]