part d : control and skidding

by devin hunt

Launch Project

This leg of the project saw the introduction of a player controlled vessel to the application. This required an intrinsic control scheme to be implemented that allowed the player to control both the lateral acceleration (velocity modification) and the normal acceleration (trajectory modification). It was found that using a constant acceleration model, where the position of the mouse dictated the velocity of the craft and not the acceleration. This model maps to the analog of the car allowing a much more intrinsic.

The speed and acceleration of the player controlled vessel is calculated by scaling the position of the mouse in both the x and y directions. The x-axis controls the lateral (turning) speed of the craft while the y-axis controls the tangential (forward) speed of the craft. By scaling positions on these two axis a velocity in the vehicles forward direction and the vehicles lateral direction can be calculated. This is then superimposed on the vehicle to move it forward at a constant speed. Figure one demonstrates this. The white vectors represent the change in the velocity as dictated by the mouse position. The left most figure is the representation of the result.

This player controlled vessel reacts to acceleration and motion exactly as the computer vessel does, as discussed in section c.

Skidding was also introduced in this iteration. A skid, for the purpose of this iteration, was simplified to describe a moment in the simulation when the acceleration of a vessel exceeds a set threshold (dictated by a coefficient of friction). The solution to the basic equation shows that if a vessel looses all control from traction the sole acting force would be that of friction, as demonstrated in the following equation.

Using this simple postulate the detection and simulation of the skid became a simple task account for all scenarios.

The function movePlayerV was created to handle the skid. A when a skid is detected the player looses all control vessel and the last known acceleration is recorded. From this moment hence the acceleration of the car is recalculated each tick taking into account a frictional force lessening the acceleration. When the vessel's acceleration has once again dropped below the traction threshold the player can then assume control of the vessel. This is most easily demonstrated by throwing the vessel into a sharp turn. Usually this action yields a violent spinout.