Setting custom mass

General discussion about the R.U.B.E editor
Post Reply
vanush
Posts: 4
Joined: Wed Apr 11, 2018 2:09 pm

Setting custom mass

Post by vanush » Wed Apr 11, 2018 2:28 pm

Box2d supports body mass that is not coupled with the density of its fixtures, so that you can set the mass data manually.
In RUBE when I set the mass of a body it changes the density of body's fixtures. Is there a way to set it without affecting fixtures?

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Setting custom mass

Post by iforce2d » Sat Apr 14, 2018 2:44 pm

No. What you can do is make all the fixtures on the body zero density, and have a single fixture that has the desired mass. Then you can move that single fixture wherever you want to set the center of mass. Of course if you don't want that single fixture to interfere with collision behavior you can make it a sensor fixture or zero out all the collision mask bits.

vanush
Posts: 4
Joined: Wed Apr 11, 2018 2:09 pm

Re: Setting custom mass

Post by vanush » Sun Apr 15, 2018 7:18 pm

Thanks! This should be an acceptable workaround.

Post Reply