Set Mass tool – Script

by - 2012/05/04 7 Comments Production

In physics simulations it’s very handy to make objects have a mass value based on their size. So for instance if you have one big and several small objects in a simulation(that are made of the same material) then the big object should be able to move and affect the smaller objects more then the other way around.

So we asked Sergey if he could write us a tool that works by checking the bounding box of the selected objects and gives them a mass value based on their size. And so he did! it didn’t take him long :)

Download the addon

Just install the addon, select the objects you want to change the mass for and then click the “Set Mass” button in the Physics tab. This changes the Rigid Body Mass value for all selected objects based on what you set in the Min/Max.

Disclaimer: This is a production tool. It’s not officially supported, so there is no bug tracker for it.

  1. Dusty says:

    Good man! :)

  2. Nathan says:

    Its great when you have a bunch of guys in a dimly lit Dutch room, and one of those guys says, “Hey you know what would be really handy?”. And another man stands up, and says “yes, and I have just made it.”.

    Ah production environments how I miss it.

  3. Hishnash says:

    Surly one could improve on this by setting the density of the object. And use mass = density*size when doing physical calculations. The disadvantage of setting density i suppose is if you deform a mesh such that the bounding box changes in size you do not preserve mass.

    • kram1032 says:

      The bounding box is kind of a hack anyway.
      It’s not difficult at all to come up with an item that has way less material than a different one.
      Just think of a fairly big solid sphere in a cage-like object.
      The cage HAS to have a bigger bounding box but it’s almost certain that the sphere will have much higher mass-per-cube (“discrete density”) than the cage, even though both might be made from the same material.

      Though I suppose, for most things you’ll come along, it’s a good approximation.

  4. Nakoe says:

    I was looking for such! I hope it will work with breaking things, based on the force and mass etc.

  5. If this is just checking bounding box it won’t work. Bounding box is simply not an answer for the real volume, specially in shards. I made a script for this in the past that approximated the real volume using “is inside” tests on 3D grid on a mesh


  6. ZanQdo says:

    Having said that! I think my solution was also flawed, first by the obvious grid resolution problem but also because to keep meaningful values between objects I had to use a fixed bound box, not adapted to each object.. nasty.

    I’ve found a GPL tool that does a volume calculation based on the geometry!

    now this looks good :)