pavel.mihaylov Posted January 19, 2012 Posted January 19, 2012 How do I get the number of bodies in the world? A function required similar to value of Pbodies showed in perfomance profiler.
carl.sutton Posted January 19, 2012 Posted January 19, 2012 If your nodes are all appended to the editor then something like this should work. Edit: int counter; int NumBodies() { counter = 0; forloop(int i = 0; engine.editor.getNumNodes()) { Node node = engine.editor.getNode(i); if(node.getParent() == 0) node_body_traversal(node, "BodyCounter"); } return counter; } void BodyCounter(Body :) { counter++; }
pavel.mihaylov Posted January 20, 2012 Author Posted January 20, 2012 Thank you Carl.I think that there is a system functionis responsible for this, which is used in the perfomance profiler,but for some reason it is not specified in the documentation or I can not find it.
manguste Posted February 7, 2012 Posted February 7, 2012 Nope, there's no such function. Performance profiler shows only bodies within physics radius. In case you want to get the number bodies, you can get them in the editor (as Carl suggested) or find intersections with the ray and check if intersected nodes have a body.
Recommended Posts