Your own model¶
Three ways, from easiest to most work.
No Unity. Use the body that ships with NPC Utilities:
Any character rigged with Adobe Mixamo's auto-rigger gets the built-in human animations, weapon holds, hit areas and ragdoll without any animation work. Steps below.
Any model with a Unity Humanoid avatar works with DSDNpcAnimBody. Weapon holds follow the vanilla player only if
your rig has a RightWeapon bone at the same path as the Mixamo skeleton; hit areas and the ragdoll need their
own physics body. Follow the Mixamo steps and the checklist, adapting bone names.
Mixamo step by step¶
1. Rig it¶
Upload your character to Mixamo, auto-rig it, and download it as FBX (T-pose, no animation).
2. Clean it in Blender¶
- Import the FBX.
- Rename every bone to drop the
mixamorig:prefix:mixamorig:LeftUpLegbecomesLeftUpLeg. Rename the vertex groups the same way. (A short script does this in one go; the game finds limbs by these plain names for gore and dismemberment.) - Name the armature object
Armature. - Scale the character to about 1.8 m tall with the feet at 0, then apply the scale.
- Export FBX: armature + mesh, no leaf bones, no animation.
import bpy
for b in bpy.data.objects["Armature"].data.bones:
b.name = b.name.replace("mixamorig:", "")
for o in bpy.data.objects:
if o.type == "MESH":
for vg in o.vertex_groups:
vg.name = vg.name.replace("mixamorig:", "")
3. Set it up in Unity¶
Use Unity 2022.3.62f2 (the game's version).
- Import the FBX. Rig: Animation Type Humanoid, Avatar Create From This Model. Open Configure and check every bone is green. Model: tick Read/Write.
- Drag it into a scene and make a prefab of it.
- Under
RightHandadd an empty child namedRightWeapon. Its path must beArmature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightWeapon(it is, on a standard Mixamo skeleton). - Tag
Armature(the hips' direct parent)E_BP_BipedRoot. Add the game's tags to your project first: everyE_BP_tag below must exist in the Tag Manager. -
Hit areas and ragdoll: on each of these bones add a collider, a kinematic Rigidbody and (except on
Hips) a CharacterJoint connected to the nearest body above it, and tag the bone:Bone Tag Collider Hips,Spine1E_BP_Bodybox HeadE_BP_Headsphere LeftArm,RightArmE_BP_LArm,E_BP_RArmcapsule LeftForeArm,RightForeArmE_BP_LLowerArm,E_BP_RLowerArmcapsule LeftUpLeg,RightUpLegE_BP_LLeg,E_BP_RLegcapsule LeftLeg,RightLegE_BP_LLowerLeg,E_BP_RLowerLegcapsule -
Materials: use a shader you ship in the same bundle. The game strips many built-in shader variants from mod bundles; a missing shader draws pink.
- Set the prefab's AssetBundle to e.g.
mynpcs, build for Windows, and copymynpcsto your mod asResources/mynpcs.unity3d.
4. Use it¶
<property name="Mesh" value="#@modfolder:Resources/mynpcs.unity3d?myHeroPrefab"/>
<property name="PhysicsBody" value="dsdNpcSurvivor"/>
<property name="DSDNpcAnimBody" value="Survivor"/>
PhysicsBody dsdNpcSurvivor works because your skeleton matches the survivor's. DSDNpcAnimBody Survivor gives your
model the full animation set: walk, run, rifle, pistol, melee and aim poses, switched by the weapon held.
Checklist¶
- [x] Humanoid avatar, all bones mapped, facing +Z, feet at 0, about 1.8 m.
- [x] Hips' direct parent tagged
E_BP_BipedRoot; the hips bone's name contains "Hips". - [x]
RightWeaponunder the right hand at the Mixamo path. - [x] Plain limb names:
Neck,LeftUpLeg,LeftLeg,RightUpLeg,RightLeg,LeftArm,LeftForeArm,RightArm,RightForeArm. - [x] Colliders + kinematic Rigidbodies + CharacterJoints, tagged
E_BP_*. - [x] Read/Write on the meshes, shader shipped in the bundle.
- [x] Unique asset names in your bundle.
Licences
Only ship models you are allowed to redistribute, and credit their authors. Mixamo characters you made yourself are yours; downloads from model sites carry their own licence.