In each step, Mark totals the X, Y and Z positions of two wheels and divides by two. In other words, he finds the average position of two wheels. He does this because there are two sets of wheels on a car.
For example, let's do the tilting from left to right. You have the front axis, which has the left-front and right-front wheels on it. But you also have the back axis. You can't really align the car to only one - the back wheels would be off the ground if you align it to the front wheels - so in order to find the best alignment, you calculate the average between the two.
Each component is calculated separately. I have no idea why he prefixes everything with z, but zx, zy and zz are the x, y and z components of the vector.
Now you also asked to explain precisely what the AlignToVector command does? It takes the axis you specify in the fourth parameter ( x, y or z ) and orients the entity so that the axis you specify is pointing along the line of the vector you pass as the first three parameters.
Again, an example. Let's suppose you have a missile, and it's modelled such that it points down the Z axis. If you now say
AlignToVector(1,0,0,3)
Your vector is (1,0,0) so it points to the right. Your axis is the z axis. It now aligns your missile so that the z axis points along that vector, which is also equivalent to the xaxis. So now your missile, which was pointing down the z axis ( into the screen ) is now pointing along the x axis ( to the right. )
That's as well as I can explain it without pictures.
For example, let's do the tilting from left to right. You have the front axis, which has the left-front and right-front wheels on it. But you also have the back axis. You can't really align the car to only one - the back wheels would be off the ground if you align it to the front wheels - so in order to find the best alignment, you calculate the average between the two.
Each component is calculated separately. I have no idea why he prefixes everything with z, but zx, zy and zz are the x, y and z components of the vector.
Now you also asked to explain precisely what the AlignToVector command does? It takes the axis you specify in the fourth parameter ( x, y or z ) and orients the entity so that the axis you specify is pointing along the line of the vector you pass as the first three parameters.
Again, an example. Let's suppose you have a missile, and it's modelled such that it points down the Z axis. If you now say
AlignToVector(1,0,0,3)
Your vector is (1,0,0) so it points to the right. Your axis is the z axis. It now aligns your missile so that the z axis points along that vector, which is also equivalent to the xaxis. So now your missile, which was pointing down the z axis ( into the screen ) is now pointing along the x axis ( to the right. )
That's as well as I can explain it without pictures.