• Create Account

#ActualMARS_999

Posted 14 April 2013 - 04:18 PM

I am using Box2D for my physics, and I am calculating magnetism on objects. What I have noticed now is when I change the screen size the objects take longer to attract to each other vs. a small screen size, which makes logical sense as the distance is less.

So how can I take this formula and make it use the same BIG G constant and be screen size independent?

Thanks!!

const float BIG_G = .2f;

b2Vec2 pk = b2->GetWorldCenter();
float mk = b2->GetMass();
b2Vec2 delta = pk - pi;
float r = delta.Length();
float force = BIG_G * mi * mk / (r*r);
delta.Normalize();


#1MARS_999

Posted 14 April 2013 - 04:17 PM

I am using Box2D for my physics, and I am calculating magnetism on objects. What I have noticed now is when I change the screen size the objects take longer to attract to each other vs. a small screen size, which makes logical sense as the distance is less.

So how can I take this formula and make it use the same BIG G constant and be screen size independent?

Thanks!!

b2Vec2 pk = b2->GetWorldCenter();

float mk = b2->GetMass();

b2Vec2 delta = pk - pi;

float r = delta.Length();

float force = BIG_G * mi * mk / (r*r);

delta.Normalize();


PARTNERS