To create a rigidbody with my destination mass, in JoltPhysics docs' method, do following:
SphereShape shape = new(0.5f);
MassProperties massProperties = shape.MassProperties;
massProperties.ScaleToMass(10);
BodyCreationSettings spherSettings = new(shape, new Double3(0, 2, 0), Quaternion.Identity, MotionType.Dynamic, Layers.Moving);
Body sphereBody = bodyInterface.CreateBody(spherSettings);
Console.WriteLine("Mass: " + 1 / sphereBody.MotionProperties.InverseMassUnchecked); // not 10
That doesn't work.
Maybe do sphereBody.MotionProperties.SetMassProperties(AllowedDOFs.All, massProperties);
after that works, but what to do if I create Rigidbody with multiple Shapes with CompoundShape? there's no way to get CompoundShape's massProperties, and ConvexHullShape even have no MassProperties, so there's only one way to do that:
SphereShape boxShapeForWorkAroundMass = new(1);
MassProperties createdMassProp = boxShapeForWorkAroundMass.MassProperties;
createdMassProp.ScaleToMass(128);
SphereShape shap = new(0.5f);
BodyCreationSettings spherSettings = new(shap, new Double3(0, 2, 0), Quaternion.Identity, MotionType.Dynamic, Layers.Moving);
Body sphereBody = bodyInterface.CreateBody(spherSettings);
bodyInterface.AddBody(sphereBody.ID, 0);
sphereBody.MotionProperties.SetMassProperties(AllowedDOFs.All, createdMassProp);
Console.WriteLine("Mass: " + 1 / sphereBody.MotionProperties.InverseMassUnchecked);//128