Set cursor to center of mass of selected bodies
Posted: Wed Apr 03, 2013 7:37 pm
Code: Select all
body[] bs = sb();
vec2 c = mv(0,0);
for (uint i= 0; i < bs.length; i++)
c += bs[i].getWorldCenter();
float n = bs.length; //this needs to be a float type
setCursor( 1/n * c );