This script has been replaced with VariableCenterOfMass
in v2.5.
A helper script for setting center of mass of a Rigidbody
.
Unity calculates center of mass as a center of volume of all the Rigidbody
s Collider
s. This can and will result in unrealistic center of mass for objects that do not have uniform density, i.e. center of mass will not have to be adjusted for a wooden log but a ship has a ballast and is noticeably heavier around the keel and therefore the center of mass is low which in turn prevents the ship from capsizing.
Center Of Mass Offset
- offset of the center of mass from the Unity calculated one in local coordinates.Show COM
- when true a green gizmo sphere will be drawn at the current center of mass.
MassFromVolume
is a helper script that calculates object's mass from volume of the mesh and the density.
Mass
field can also be set manually.MassFromChildren
to calculate mass of complex objects (objects having more than one child WaterObject
).
A helper script for determining mass of a Rigidbody from the children. It sums the masses of all the children that have WaterObjectMassHelper
scripts attached. This eliminates the need for guessing the mass of the object.
Rigidbody
component.WaterObjectMassHelper
attached or the result will be 0 and ignored.Rigidbody
's mass.