Hello,
I'm coding a "magnet" of sorts in Box2D. Right now it's only acting on the center of mass on a body, but I would like
it to be a little more accurate and effect each shape of the body separately, based on weight and position.
My first problem is that I can't seem to find an easy way to get the world position of a shapes center? All I can
find is the relative local center for circles, but this doesn't seem to be relative to the body's center of mass?
And for polygons, all I can find is the "centroid", which, it seems, doesn't say anything about the relative position of the
polygon shape in the body.
Also, is there an easy way to get the weight of a shape (if it's stored) or would I have to calculate it on the fly each time?
Thanks in advance!
I'm coding a "magnet" of sorts in Box2D. Right now it's only acting on the center of mass on a body, but I would like
it to be a little more accurate and effect each shape of the body separately, based on weight and position.
My first problem is that I can't seem to find an easy way to get the world position of a shapes center? All I can
find is the relative local center for circles, but this doesn't seem to be relative to the body's center of mass?
And for polygons, all I can find is the "centroid", which, it seems, doesn't say anything about the relative position of the
polygon shape in the body.
Also, is there an easy way to get the weight of a shape (if it's stored) or would I have to calculate it on the fly each time?
Thanks in advance!