SpawnAgent / SpawnTroop

Users who are viewing this thread

The_Schwarz

Regular
I have been working on trying to expand the dismemberment mod to include other body parts.
Based on what I see and within the constraints of the mesh architecture we could lop off Hands and Feet unfortunately cannot currently target one or the other but both or nothing would work.

Current logic is duplicating the Victim Agent and hiding all but the dismembered Item. But for some strange reason even though the SetVisibilityMask(VisibilityMaskFlags.EditModeShadows) hides the Head, Hands or Feet on the Original agent when doing the same for the copy
the Head meshes will not. So you chop the Feet you get a Head/Feet falling to the ground.... You chop the Arm you get Head and Hand Meshes.

Damnedest thing I ever seen.

Here is the Agent Creation line being used excluded the victimBuildData block which is actually an AgentBuildData class.
and the two loops being used to cycle through all the meshes in victim.AgentVisuals.GetSkeleton().GetAllMeshes() collection.

Any ideas to mask the head on the copy would be great.

Code:
//Creat the Copy of target Agent, This will be the one that all meshes but the dismembered part will be visible.
Agent victimCopy = Mission.Current.SpawnAgent(victimBuildData, true, 0);

........

foreach (Mesh mesh in victim.AgentVisuals.GetSkeleton().GetAllMeshes()) {
     //Hide the parts that were dismembered
     if (meshNameParts.Any(meshName => mesh.Name.ToLower().Contains(meshName))) {
          //mesh.SetVisibilityMask(VisibilityMaskFlags.EditModeShadows);
          victim_HideMesh.Add(mesh.Name);
     }
     else {
          foreach (Mesh mesh2 in victimCopy.AgentVisuals.GetSkeleton().GetAllMeshes()) {
               //Hide all but the parts that were dismembered
               if (mesh.Name.ToLower() == mesh2.Name.ToLower()) {
                    //mesh2.SetVisibilityMask(VisibilityMaskFlags.EditModeShadows);
                    victimCopy_HideMesh.Add(mesh.Name);
                    break;
               }
          }
     }
}
 
Last edited:
Back
Top Bottom