0
\$\begingroup\$

I am trying to write a physics engine from scratch to get a better understanding of them. It worked pretty good so far, but there is one thing, i can't get my head around:

Example:

If i have a rigid body ( for example circles or rectangles) and i am applying a force F at a point P to it. Now my problem is to figure out, how this force will affect translation speed and rotation speed of the rigid body. So far i have figured out, that it might has to do with the center of mass and the moment of inertia.

\$\endgroup\$
3
\$\begingroup\$

So far i have figured out, that it might has to do with the center of mass and the moment of inertia.

You're right, it does have to do with the center of mass and the inertia.

The resultant force is simply, the original force plus the force applied. The resultant torque is equal to the original torque plus the cross product of the force vector with the radius (the vector from the COM to the point of application of force. This holds true for both 2 dimensions and 3 dimensions.

All in all, the simple AddForceAtPosition function will be:

void AddForceAtPosition(Vector3 f, Vector3 point)
{
    force += f;
    torque += cross(point - centerOfMass, f);
}

In 2D the cross product of two vectors is a scalar in the Z direction, whose value is governed by this formula:

cross(a, b) = a.x * b.y - a.y * b.x

Or simply the determinant of both the 2D vectors A and B.

\$\endgroup\$
  • \$\begingroup\$ It might be worth noting that as this system evolves, if you maintain the same linear force, then the torque will change due to the cross product changing. The torque tends to 0 as your rigid body "straightens out" its motion to be parallel to the force vector. \$\endgroup\$ – dannuic Jan 27 '16 at 18:50
0
\$\begingroup\$

Might not be useful but for a simple equation F=(mv^2)/r where f is the force, m is mass, v velocity and r radius. I'm not 100% sure but I think inertia is the force acting to slow down an object not speed it up.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.