Up to this point, we haven't addressed the issue of the player hanging out of the side of the vehicle every time the they enter it. This is due to the fact that there is no sitting position defined for the driver position and thus leaves the player in the last position and pose before entering the vehicle. In this recipe, we will fix this problem by creating a new helper within the vehicle XML.
Complete the Creating a new car XML recipe. Then open MyVehicle.xml
in Notepad or an equivalent editor.
<Parts>
and <Seats>
cells, you will need to insert the following lines into the car XML:<Helpers> <Helper name="driver_sit_pos" position="-0.75,0.25,1.5"direction="0,1,0" part="body"/> </Helpers>
Helpers
cell, we now need to define on the driver seat which helper the player needs to take in order to be positioned in that seat.<Seat name="driver">
cell, you will need to change the following property:sitHelper=""
sitHelper="driver_sit_pos"
This simple seat helper lets the vehicle code know where the passengers of that particular seat need to be positioned in the vehicle. Be aware that this only aligns the root pivot of the character to this position. So in order to pose a character to sit in this position, it is a good practice to create a new animation graph and animation that moves the character so that the root pivot aligns to a bone on the character such as the pelvis.
You can use the HMMWV animation graph to give a seated position to your character. If no changes to the player model have been made to the skeleton, then we will be able to utilize the animation graph from the SDK's HMMWV to pose our character. Within the same <Seat name="driver">
cell, add the following property:
agVehicleName="HMMWV"
This will use the animation graph to play the same animations used for entering and exiting the vehicle as well as utilizing the same sitting pose as the one used for the HMMWV.
18.118.138.195