Description
The Mass
property represents the total mass of all the dynamic PhysicsBodies in this PhysicsGroup
. When you set the total mass, it is distributed among the bodies proportionally to their previous masses. For example, if a body previously had 25% of the total mass, it will retain 25% of the new total mass.
Usage
Use the Mass
property to get or set the total mass of the dynamic physics bodies within a PhysicsGroup
. When setting the mass, ensure that the distribution of mass among the bodies is appropriate for your simulation needs.
Example
// Example of setting the mass of a PhysicsGroup
PhysicsGroup group = new PhysicsGroup();
group.Mass = 100.0f; // Sets the total mass of the group to 100 units
// Accessing the mass of the group
float totalMass = group.Mass;
// totalMass now holds the value 100.0f