
CHAPTER 4 ■ WORKING WITH MODELS
371
Figure 4-23. Pointsofinterestwhentiltingacar
You can find the position of both points easily by taking the average of their neighboring
wheels. You can find the vector between them, backToFront, by subtracting them from each
other:
Vector3 front = (frontLeft + frontRight) / 2.0f;
Vector3 back = (backLeft + backRight) / 2.0f;
Vector3 backToFront = front - back;
Remember,youwanttofindhowmuchyoushouldrotateyourcararounditsSidevector,
so its front point is moved upward or downward. Ideally, you want your frontToBack vector to
have the same inclination as the terrain slope, as shown in Figure ...