Recommended mass/force ranges for 2d physics

So in the fighting game I’m working on I tuned all the physics values to something that feels right in-game and it’s working fine, but I was wondering if there’s value in reworking the numbers to be closer to “real world”.

The docs mention the physics engine is tuned to work well in the 0.1 to 10 metre range. The pixel size of a fighter is roughly 200 pixels, so a physics scale of 0.1 is appropriate (well, actually the fighter GO is scaled to twice the size, so the fighters are “actually” 4 metres high, but that’s still within the recommended range.

However, I kept the mass at 1 and adjusted the gravity and force applied from hits to values that made the game behave more or less the way I wanted. For example the force applied (once!) during an uppercut is vmath.vector3(14000, 120000, 0). I suppose changing the weight of the fighter collision object to 85 (kg?) and multiplying the force by the same amount would lead to the same result. Another thing to consider is to spread the force over several frames, though I kinda want the jerky way it looks now.

My question is - is there a sweet spot for the values of mass and/or force applied similar to the one when it comes to sizes?

I can and almost certainly will try to fiddle with these things, but I’d like to know a bit about the inner workings so I don’t stumble in the dark. It can sometimes be hard to evaluate the difference after changing the physics in a major way, since I’m relying on feelings rather than any objective measures most of the time.

Applying the force over many frames is usually what happens. Applying a force that is there for only 1/60 of a second and then gone again isn’t “realistic”. But hey, it’s a game so do whatever works for your game!

1 Like

Applying a single (but more powerful) force, is called an impulse, and is how collisions are usually resolved.
For instance, if you’d want to simulate an explosion, you’d apply an impulse to an object, in the direction away from the center of explosion.

1 Like

True. An explosion generates a lot of force in a very short period of time.

I’m trying to simulate my fist, so yeah. Explosion is definitely the way to go =P

1 Like

Depending on the needs one can do it more or less complex.
But essentially the impulse = mass * velocity_change is the short version.
(Read more on the web)

2 Likes

Correct me if I’m wrong: Apply force works over the whole frame-time, so applying the same large force in one frame will be heavily affected by your framerate. You should divide by dt to make it a consistent impulse.

In my experience trying to use real-world settings doesn’t look or feel right at all. Everything ends up really slow and floaty. But maybe I’ve always gotten my units off by a factor of 10 or 100…

2 Likes

Correct, the total force is usually collected over a frame, then applied using the time step.