How to use Custom Characters and Animations
Last updated
Last updated
This page covers how to use the features of Procedural NPC Crowds in Blueprints.
For this example, we will stick with the demo content, but you can use your own character classes. Just make sure they have an AI detour crowd controller, character movement, and behavior tree running.
Find the Demo_Content folder and open the Pedestrian->Blueprints->BP_Pedestrian character class.
Ensure you have imported custom skeletal meshes, set their materials in the Skeletal Mesh Editor, and that they share a skeletal rig for animations. Use an animation blueprint made for them. I will not cover making animation blueprints here, as there are a plethora of tutorials on YouTube for this already.
To randomize character spawns after setting up the character model assets and animations properly, delete the nodes on begin play of BP_Pedestrian to remove the procedural material.
Make a new function or custom event called "randomize character model".
Inside this function or custom event (I will be using a custom event), we need to set the mesh. To do this, create a new variable of type Skeletal Mesh and make it an array
After creating this variable, add the skeletal meshes you want to use. We will separate male and female models so they can have variety.
In the Event Graph, copy this code and call the function on Begin Play where the random material was.
Thats it, you should now have male and female characters walking around instead of the mannequin.