So, I'm trying to simulate polygon rigid body physics, both linear and angular.

To calculate the MTV is easy in SAT (Minimum Translation Vector), and to use it to adjust position is also easy:

PolygonA.center -= MTV * .5
PolygonB.center += MTV * .5

But if you want to adjust velocity and angular velocity with it how would you do that?

This is what I've thinked about, I haven't tested it yet though in my program:

AccelerationA = -MTV * (2 * PolygonB.mass / (PolygonA.mass + PolygonB.mass))
AccelerationB = MTV * (2 * PolygonA.mass / (PolygonA.mass + PolygonB.mass))

PolygonA.velocity += AccelerationA
PolygonB.velocity += AccelerationB

PolygonA.angularVelocity = Cross(Normalize(AccelerationA), PolygonA.velocity) / PolygonA.radius
PolygonB.angularVelocity = Cross(Normalize(AccelerationB), PolygonB.velocity) / PolygonB.radius

Where radius is the longest distance from the center to the fartherst vertex, the rotation axis length of that polygon.

Now is my idea correct?, and if not, how do I fix it?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.