This is a common script shared between all the vehicle focused NWH assets.
Since Unity 2022 this script is no longer needed to adjust center of mass or inertia from the inspector as those settings are now exposed through Rigidbody inspector.
Rigidbody
through the inspector. In Unity 2023 and newer this can be done through the Rigidbody
inspector.MassAffector
feature where the mass, center of mass and inertia can be impacted by MassAffector
s attached to the vehicle. This can be a fuel tank, a piece of cargo, a player, etc. MassAffectors
, despite affecting the Rigidbody properties, are not Rigidbodies
. This allows for things like cargo to affect the vehicle, without having the overhead of Rigidbody collisions/joints/etc.VariableCenterOfMass
is designed to give users more control over the Rigidbody which is usually needed for use with vehicles. This is because Unity assumes all objects/colliders have uniform density and therefore calculates the center of mass and inertia using that assumption. This script allows for tweaking of both of these values to better fit the specific vehicle. Center of mass and inertia tensor, besides mass, have the biggest effect on vehicle handling.IMassAffector
s. There are components attached to different parts of the vehicle that affect the vehicle mass, the center of mass, and inertia but are not Rigidbodies by themselves. Examples of this would be fuel tanks, passengers, cargo, etc.MassAffector
(or any script inheriting from IMassAffector
to a GameObject
that is a child of the vehicle.Use Mass Affectors
on the VariableCenterOfMass
component.Use Default …
for the properties that the MassAffector
s should affect.