Jump to content

[SOLVED] Number of bodies in the world.


photo

Recommended Posts

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++;
}

Link to comment

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.

Link to comment
  • 3 weeks later...

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.

Link to comment
×
×
  • Create New...