In this example we’ll replace the included avatar model with Unity’s Ethan model from the Standard Assets package to demonstrate how to configure a new humanoid avatar. https://www.assetstore.unity3d.com/en/#!/content/32351
- Open the “IK Driver Day Demo” scene located in the “Assets\TurnTheGameOn\IK Driver\Scenes” folder. This scene contains the IK Driver Demo Controller that spawns and holds a reference to the vehicle controller prefabs.
- Duplicate the “IK Driver Left Steering” prefab in the “Assets\TurnTheGameOn\IK Driver\Prefabs” folder, rename it to “IK Driver Tutorial”, then drag it into the scene and disable the “IK Driver Demo Controller”. This is your new vehicle prefab, you can change the name to whatever you like.
- Bring the new Avatar model “Ethan” into the scene as a child of the default “Race Driver” avatar object so the “Ethan” model can inherit the same transform values.
- Ethan will replace the current avatar named “Race Driver”, but before we remove the old model we can copy the required component settings. First, let’s now make the “Ethan” object a child of the “IK Driver Avatar” object.
- Copy the “Animator” and “IKD_IK Driver” components from the “Racer” object and paste them onto the “Ethan” object.
Paste the old avatar’s “Animator” component values onto Ethan’s “Animator” component.
Paste the old avatar’s “IKD_IKDriver” script component as a new component onto Ethan’s object.
- Re-assign Ethan’s avatar to his Animator component.
- Move the Helmet Camera from the old Racer model’s head bone to Ethan’s head bone.
- Delete the old “Race Driver” object.
- Next we’ll need to make a couple adjustments, enter playmode and press “C” to switch to the helmet camera view. You’ll notice the camera needs to be moved to a better position and rotation, use the scene view transform tool to move and rotate the camera into a good place. copy your adjusted transform component values while in play mode, exit play mode and paste them to your camera. I found the position (-0.09, 0.03, 0) and rotation (86, 83, 178) to be good values.
- The final change we’ll need to make is to adjust the avatar and/or steering wheel positions so it looks like Ethan’s hands are holding the wheel properly.
For Ethan, he is a model of a teenager, so he’s a bit smaller compared to a full grown adult; you will most likely run into small adjustments that need to be made on a case by case basis, as we see here for Ethan, depending on the body type of your model. We could have also increased the scale factor in Ethan’s fbx import settings to make him larger in this case, but then he’s not a kid anymore. This process will be a multi-step process so let’s break it down.
10.1 First let’s adjust the steering wheel’s transform position to be in Ethan’s hands while in play mode. Find a good spot and copy the new transform values, exit play mode and paste the values.
10.2 While not in play mode, unparent the “Steering_Left” object from the “IK Steering Wheel”, then enter play mode, move and resize the “IK Steering Wheel” in the scene view to adjust radius of the IK Targets without resizing the steering wheel model. My new scale is 0.95. Copy the transform, exit play mode and paste the new values.
10.3 You can now re-parent the “Steering_Left” object to “IK Steering Wheel”, Ethan’s hands should now be on the steering wheel. Press play and take a look at your scene view, make additional IK Target adjustments if necessary, in my case I’ll adjust the “IK Target W” used by the left hand to reposition where it rests, copy then paste the new transform value outside of play mode. I can also move the “IK Target E” to place that hand on the wheel as well if I wanted.
- This looks good while idling, but if I try to steer it becomes obvious that Ethan’s still too far away from the steering wheel, I’ll need to move his avatar position closer to the steering wheel.
11.1 Enable play mode and select the “Ethan” object, use the scene view transform move tool to bring him closer to the steering wheel, you’ll notice from my example that his arms now have some bend to them which allows him to always be able to reach the steering wheel as it rotates to a position farther than he was able to reach before. I also moved him up on the Y axis a little since he’s so short. Copy the new transform value and exit play mode.
11.2 Paste the new transform values from the previous step onto Ethan’s transform, then in the “IKD_IKDriver” script assign the new avatar position value.
- Apply the changes to the new prefab and enjoy!