Defining a sitting location
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.
Getting ready
Complete the Creating a new car XML recipe. Then open MyVehicle.xml
in Notepad or an equivalent editor.
How to do it...
Between the
<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>
After writing in the
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.For the
<Seat name="driver">
cell, you will need...