# Physics-Based Vehicle Simulation Using PD Servo
## 5 Vehicle Deformation  
To keep vehicle running on the ground all the time, the proposed system keeps detecting a static collision between wheels and ground plane without penetration. For computational efficiency, a simple square box that covers the vehicle body is used for any detection from outside. Using this collision detector, the vehicle body starts to deform if any object goes into the box or stops deforming if a part of the body goes out of the box.  
In the event of a vehicle crash, the box collision detector calculates the direction and magnitude of collision impulse for each frame. Based on the impulse force, the key body parts such as front bumper and wheels translate their positions and change their shapes to represent the surface deformation. For smooth deformation, the linear blend skinning (LBS) is a method that transforms vertices inside a single mesh by a blend of multiple transforms. It is widely used due to its simple implementation and fast performance. Given a mesh model, it decides the vertex position according to the final transformation matrix, which is the result of multiplication of all required transformation matrices (scaling, translating, rotating), as follows:  
\[\bar{\mathbf{p}}_{i}=\sum_{j=1}^{N_{B}}w_{ij}\mathbf{T}_{j}\mathbf{p}_{i}, \tag{5}\]  
where \(\mathbf{p}_{i}\) (\(\mathbb{R}^{3}\)) is the vertex position of the \(i\)th mesh in resting pose, \(\bar{\mathbf{p}}_{i}\) (\(\mathbb{R}^{3}\)) is the vertex position after deformation, \(N_{B}\) is the number of bones, \(\mathbf{T}_{j}\) is a \(4\times 4\) matrix that defines a global transformation of the \(j\)th bone from its rest pose, and \(w_{ij}\) is a scalar weight at the \(i\)th vertex associated with the \(j\)th bone. As the LBS method does not consider each property of the required transformations, it causes the candy wrapper problem which produces an visual artifact such as an intermittent twisting surface.  
To deform the surface of the vehicle model, the proposed system adopts the dual quaternion skinning (DQS) method, which is a skinning algorithm based on a linear combination of dual quaternions [29]. In this method, DQS decides the vertex position with dual quaternion values which are used for interpolation instead of \(\mathbf{T}_{j}\) in Equation (5). Each quaternion includes rotational and translational transformations as follows:  
\[\dot{q}=\frac{\sum_{i=1}^{N_{B}}w_{i}\dot{q}_{i}}{\left|\sum_{i=1}^{N_{B}}w_{ i}\dot{q}_{i}\right|}, \tag{6}\]  
where \(\dot{q}_{i}\) (\(\mathbb{S}^{3}\)) is the bone's dual quaternions (transformations) weighted by \(w_{i}\). It is notable that Equation (6) estimates the two transformations separately and does not have any scaling factor, providing a faster computation without the candy wrapper artifact.  
Figure 10 shows the part of the vehicle body deformed by the impulse force. In the figure, the left body part, which is described in Section 3, is lifted and dented based on the empirical values. During bumper deformation, the translational axis of the wheels is moved together with the bumper to prevent any self-penetration, as shown in Figure 11. Figure 12 shows an example of a crash scene between two vehicles in which the bumper is moved backward and bent.