- #1
Xcrypt
- 21
- 0
Hello.
I'm currently coding on a physics engine.
To do so, I looked up some code from open-source engines.
I noted that there is a function where you can apply a force to a rigid body, outside it's center of mass.
It goes something like this:
ApplyForceAPosition(vector force, vector positionWorld);
Where the resultant torque would be
distance(positionWorld,m_centerofmass)*force*sin(theta),
as expected.
However, applying the force outside the center of mass can also cause a linear force.
it would be calculated as follows:
m_Force = force;
But this seems strange to me. If I put balance pen on one finger, and I apply a force to it, so that it would spin, I can do so without visually noticing any change in linear velocity.
So it seems to me that a more appropriate formula to compute the resulting linear force from a force applied outside the center of mass would be:
m_force = |cos(theta)|*force;
Where theta would be the angle between the force vector and [forcepos-COM].
I can't seem to find any articles on this, and I'm most likely wrong, but then how come I can spin a pen on one finger without causing any change in linear velocity?
I'm currently coding on a physics engine.
To do so, I looked up some code from open-source engines.
I noted that there is a function where you can apply a force to a rigid body, outside it's center of mass.
It goes something like this:
ApplyForceAPosition(vector force, vector positionWorld);
Where the resultant torque would be
distance(positionWorld,m_centerofmass)*force*sin(theta),
as expected.
However, applying the force outside the center of mass can also cause a linear force.
it would be calculated as follows:
m_Force = force;
But this seems strange to me. If I put balance pen on one finger, and I apply a force to it, so that it would spin, I can do so without visually noticing any change in linear velocity.
So it seems to me that a more appropriate formula to compute the resulting linear force from a force applied outside the center of mass would be:
m_force = |cos(theta)|*force;
Where theta would be the angle between the force vector and [forcepos-COM].
I can't seem to find any articles on this, and I'm most likely wrong, but then how come I can spin a pen on one finger without causing any change in linear velocity?