Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is inverse mass? How should I determine it?
#1
Hi.
I create obi actor objects by script in run time without setting actor.solver.invMasses[index] for each particle. It seems the obi handle everything and give some proper parameters to my actors but I do not understand what inverse mass is and why we use it. I googled but could not find proper document that I could understand.
For now I have no issue with that but I would like to have better understandings for the future.
In a ObiActorCenterOfMass.cs, I found a line below:
  • massAccumulator += 1.0f / invMass;
I understand above line as below:
  • Mass = 1.0f / (Sum of inverseMasses)

For example, if I would like to make an actor with four particles with a total mass of 150 it should be like this.
  • 150 = 1 / (4 * invMass)
  • invMass = 1.0f / 600f = 0.00166
The answer indicates I give 0.00166 to each particle's invMass.
Someone please let me know if I am correct.
Reply
#2
Inverse mass is literally 1/mass. Why not use mass instead then? for two reasons:
  • Efficiency. Internally, expressions like something / (1/massA + 1/massB + ... + 1/massN) are extremely common and happen literally tens of thousands of times each frame. By storing inverse masses instead of masses, we can skip all the divisions. This takes pressure off the ALU, reducing the amount of processor cycles used to calculate things, making the engine faster.

  •  Intuitiveness. Unlike mass, inverse mass is directly proportional to how sensitive a particle is to forces. Setting inverse mass to zero, is equivalent to giving a particle infinite mass (minus having to deal with the ugly and risky infinity/NaN values explicitly). This causes the particle to be impervious to forces. Setting it to a high value makes the particle very sensitive to forces.

Regarding your math: if you want to make an actor with 4 particles and a total mass of 150 kg, you'd simply do:

Code:
particleMass = 150/4; // total mass divided by the amount of particles, so we get the mass each particle needs to have
particleInverseMass = 1/particleMass; // calculate the reciprocal of the mass.

So the invMass for each particle needs to be 1/(150/4) = 0.02666.
You can check that this is correct by calculating the total mass of the 4 particles:

Code:
particleMass = 1/0.02666;
totalMass = particleMass * 4;

The result is 150.037, so we know our original formula is spot on.  (I truncated the inverse mass to five decimals, hence the .037 in the reconstructed total mass).

I don't know where the 600 value comes from in your formula.

Quote:In a ObiActorCenterOfMass.cs, I found a line below:
massAccumulator += 1.0f / invMass;
I understand above line as below:
Mass = 1.0f / (Sum of inverseMasses)

This is wrong. Keep in mind that 1/a + 1/b + 1/c  is not equivalent to  1/(a+b+c). It's easy to make this mistake.
Reply
#3
Thank you so much for the reply and the lecture!
My question has been answered very clearly and easily to understand!

Where did the 600 come from? Hmm..., maybe from my bad attitude toward math studying in the elementary school.
Reply
#4
(31-03-2020, 11:51 AM)Snail921 Wrote: Thank you so much for the reply and the lecture!
My question has been answered very clearly and easily to understand!

Where did the 600 come from? Hmm..., maybe from my bad attitude toward math studying in the elementary school.

You're welcome! I loathed math for most of my teenage years, but it is actually awesome and extremely useful Sonrisa
Reply