where cSphere_node is an instance of CollisioneNode class BUT…
…er… CollisionNode class DOESN’T have any method called show
So, what’s the real correct why of showing a collision ray for debugging purpose? Should I treat che CollisionNode as a PandaNode and wrap it in a NodePath and use NodePath’s show method?
Well actually that’s the same thing, CollisionTraverser.showCollision just creates a CollisionVisualizer.
Anyway, that seems to just show collisions, not actual collision solids. The only way I found to show collision solids is the following
nodep=wind->load_model(panda->get_models(),modelname);
nodep.set_pos(2,2,4);
PT(CollisionRay) cr = new CollisionRay(0,0,0,0,0,-1);
CollisionNode *cRay_node= new CollisionNode("Ray");
cRay_node->add_solid(cr);
NodePath collNp =nodep.attach_new_node(cRay_node);
collNp.show();
in this code I load an egg model, create a collision ray and attach it to the model: this way I get a NodePath for the CollisionNode object and I call show() to actually show the CollisionNode containing the collision ray.
This way sounds quite correct and logic to me, since the ray had to be attached to the model 'coz it should move with it (is a classic -Z ray to detect floor)