Hello again. This series of articles were not abandoned, just paused as I experimented more with hair and other engine features. In previous parts I had stated I was happy with the hairstyle. However, I decided to change a tiny detail that I was not entirely happy with. I changed the shape of the little bun at the top of her head, because the pointy part made it look bad. I decided to change it in Maya and reimport it.
Now, let’s continue with the subject. This time I am exploring actually setting up the hair for a playable character. Previously, I had just placed the hair as a child of the character and applied an animation to it, but that’s not good if you want the hair to be part of the character.
What I did was to make my own default Pawn class (using the third person’s template as a starting point). As explained in part 5, I made the hair from 2 different parts, the hair cap and the loose hair that flows down to her shoulders. In my Pawn class I added those two as components under the Mesh(Inherited) component. One thing you need to keep in mind is that doing this will only parent the hair to the mesh, you are not parenting to a specific bone. You can see below how my hierarchy looks like (ignore the “Detectpoint_Head” object, since that’s just something I added to test AI detection).
The next part that I think is important is the Bend Constraint part. There’s a part called Stiffness Scale that you can use to set how stiff the hair is along its length. I decided to create a curve, since that can be reused for other hair types. The following image shows the settings I’ve used for this.
And this is my external curve being used for the Bend Constraint Stiffness Scale.
One thing to keep in mind is that hair will need a PhysicsAsset for collisions. You don’t really need to create one, since, when you import your characters into Unreal Engine 4, 3 assets are created by default: The Skeletal Mesh, the Physics Asset and the Skeleton. All you need to do is edit your Physics Asset to adjust it to your character, and you are done. I added capsule colliders to the head to better simulate the shape of her head (and prevent the hair from getting into the head’s mesh), I adjusted the collisions on the torso using 2 capsules to more or less follow the shape of that body part and, to prevent the hair getting into her breasts’ geometry, I also added two spheres (one for each breast). You can see the forearms don’t have colliders. That’s because, originally, her arms would be down all the time so I didn’t really need to check for collisions between the forearms and the hair, but now that her default idle and walking animations show her “hugging” herself across the chest, I may need to add them.
As I worked with the hair, I kept having a specific issue where the hair moved in a very undesirable way as she walked, and the problem was even worse when she ran. You can see the video below to understand what I mean.
As I was looking for a way to fix the issue, I noticed this setting for Hair Interpolation near the end of the Details pane. The image below shows the default settings.
This sounds like the kind of setting that would affect how the hair moves along. As you see in the video above, it almost looks like it's lagging behind the character, or over-compensating for the character's movement. I figured modifying this setting would help solve the issue, and it did. This image shows the settings I used.
And here’s the result of this change.
There are still a few things that I can touch on, like improving the overall look of the hair, but that’s something for another day. In the meantime, take the time to experiment with hair and make sure to show us what you create!
Get Unreal Engine: https://www.unrealengine.com/en-US/get-now