private void ActivateJetpackRagdoll() { if (RagdollMapper == null || Character.Physics == null || Character.Physics.Ragdoll == null) { return; } if (!MyPerGameSettings.EnableRagdollModels) { return; } if (!MyPerGameSettings.EnableRagdollInJetpack) { return; } if (Character.Physics.HavokWorld == null) { return; } List <string> bodies = new List <string>(); string[] bodiesArray; if (Character.CurrentWeapon == null) { if (Character.Definition.RagdollPartialSimulations.TryGetValue("Jetpack", out bodiesArray)) { bodies.AddArray(bodiesArray); } else { // Fallback if missing definitions bodies.Add("Ragdoll_SE_rig_LUpperarm001"); bodies.Add("Ragdoll_SE_rig_LForearm001"); bodies.Add("Ragdoll_SE_rig_LPalm001"); bodies.Add("Ragdoll_SE_rig_RUpperarm001"); bodies.Add("Ragdoll_SE_rig_RForearm001"); bodies.Add("Ragdoll_SE_rig_RPalm001"); bodies.Add("Ragdoll_SE_rig_LThigh001"); bodies.Add("Ragdoll_SE_rig_LCalf001"); bodies.Add("Ragdoll_SE_rig_LFoot001"); bodies.Add("Ragdoll_SE_rig_RThigh001"); bodies.Add("Ragdoll_SE_rig_RCalf001"); bodies.Add("Ragdoll_SE_rig_RFoot001"); } } else { if (Character.Definition.RagdollPartialSimulations.TryGetValue("Jetpack_Weapon", out bodiesArray)) { bodies.AddArray(bodiesArray); } else { bodies.Add("Ragdoll_SE_rig_LThigh001"); bodies.Add("Ragdoll_SE_rig_LCalf001"); bodies.Add("Ragdoll_SE_rig_LFoot001"); bodies.Add("Ragdoll_SE_rig_RThigh001"); bodies.Add("Ragdoll_SE_rig_RCalf001"); bodies.Add("Ragdoll_SE_rig_RFoot001"); } } List <int> simulatedBodies = new List <int>(); foreach (var body in bodies) { simulatedBodies.Add(RagdollMapper.BodyIndex(body)); } if (!Character.Physics.IsRagdollModeActive) { Character.Physics.SwitchToRagdollMode(false); } if (Character.Physics.IsRagdollModeActive) { RagdollMapper.ActivatePartialSimulation(simulatedBodies); } // This is hack, ragdoll in jetpack sometimes can't settle and simulation is broken, if we find another way how to avoid that, this can be disabled if (!MyFakes.ENABLE_JETPACK_RAGDOLL_COLLISIONS) { foreach (var body in Character.Physics.Ragdoll.RigidBodies) { var info = HkGroupFilter.CalcFilterInfo(MyPhysics.RagdollCollisionLayer, 0, 0, 0); Character.Physics.HavokWorld.DisableCollisionsBetween(MyPhysics.RagdollCollisionLayer, MyPhysics.RagdollCollisionLayer); body.SetCollisionFilterInfo(info); body.LinearVelocity = Vector3.Zero; body.AngularVelocity = Vector3.Zero; } } RagdollMapper.ResetRagdoll(Character.WorldMatrix); }