CollisionNode add_solid CollisionPolygon

LVecBase3f a = LVecBase3f(100, 100, 100);
LVecBase3f b = LVecBase3f(-100, 100, 100);
LVecBase3f c = LVecBase3f(-100, -100, 100);
LVecBase3f d = LVecBase3f(100, -100, 100);
PT(CollisionPolygon) map_quad = new CollisionPolygon(a,b,c,d);

PT(CollisionNode) map_CNode = new CollisionNode("mapColl");

c_trav.add_collider(map_NP, pick_handler);

I tried to make a CollisionPolygon with the 4 points above for my picking. It builds fine but when i run the application, i get an asserton error on the line map_CNode->add_solid(map_quad);

I used somewhat the same code to create other collision solids such as spheres which worked fine (replace new CollisionPolygon() with CollisionSphere()). But it just isn’t working for CollisionPolygon.

Without knowing exactly which version of Panda you’re using, I can’t tell you precisely what this assertion means, but this is a NodePath assertion, not a collision assertion. I suspect you’re actually getting the error with the line:


Is it possible that map_NP is an empty NodePath? Maybe you meant to do this line instead:

map_NP = NodePath(map_CNode);