public void SetHeadToPhysic(bool active, bool delayPhysics = false)
{
if (active) {
KAS_Shared.DebugLog("SetHeadToPhysic(Winch) - Create physical object");
headPhysicModule = part.gameObject.GetComponent<KASModulePhysicChild>();
if (!headPhysicModule) {
KAS_Shared.DebugLog(
"SetHeadToPhysic(Winch) - KASModulePhysicChild do not exist, adding it...");
headPhysicModule = part.gameObject.AddComponent<KASModulePhysicChild>();
}
headPhysicModule.StartPhysics(headTransform.gameObject, headMass, delayPhysics: delayPhysics);
} else {
// Yes, it must be immediate. Otherwise, the further code will try to behave on the module.
DestroyImmediate(headPhysicModule);
}
}