# BulletSim/VehicleTuning

## Bullet Vehicle Tuning

BulletSim implements the SL simple vehicle model. One goal of BulletSim is to allow easy porting of scripts from other virtual worlds and, for SL vehicles, to have the scripts operate similarly in BulletSim and SL. Measurements were taken of vehicles running under ODE, BulletSim and on SL and these measurements and analysis are given below

The measurements were created by driving a simple vehicle (5 prim linkset consisting of four spheres for wheels and one cube for a vehicle body). The vehicle ran a Simple Vehicle Script which used the LSL vehicle VEHICLE_CAR default parameter settings (unless as noted below). The script enabled an operator to drive the vehicle with the keyboard arrow keys while outputting chat messages of the vehicle’s operation. This chat output was copied into a spreadsheet and converted into the graphs shown below.

This page an ongoing discussion of BulletSim's implementation of the SL simple vehicle model. As measurements are made, improvements will be made to BulletSim. Discussions will be dated so the current state can be assessed as well as the steps to get there.

### SL Simple Vehicle 180 Degree Turn on Flat Terrain

The below chart is of the simple vehicle doing a 180 degree turn on flat terrain. The graph displays the direction of the car as the dotted line which can be seen going from about 1.6 radians down to -1.5 radians (the 180 degree turn). The blue line which rises to about 12 meters/sec and stays there is the vehicle’s forward speed. The red line (which cannot be seen in this graph since it matches the forward speed exactly) is the vehicle’s “X” dimension speed. Since the “X” speed matched the vehicle speed, this indicates that the vehicle was always pointing in the direction it was moving. The square shaped purple line denotes when the operator pressed the ‘turn’ control. The yellow line at the bottom is the vehicle’s velocity in the “Y” dimension. That is, that is the speed the vehicle is moving sideways.

The reading of this graph shows the SL vehicle turning at a constant rate (the straight line of the changing direction) while the speed does not change and there is a little sideways “drift”.

### ODE Simple Vehicle 180 Degree Turn on Flat Terrain

The same vehicle experiment was done under OpenSimulator using the ODE physics engine. The below graph is the same variables as the previous experiment and the lines of the same color represent the same measurements.

As can be seen, the vehicle turned the 180 degrees at a constant rate (the dotted line) while the control was being pressed, the velocity did not change and there was a small amount of “drift” during the turn. The variation in “Y” speed after the turn seems to be an oddity of ODE.

### BulletSim Simple Vehicle 180 Degree Turn on Flat Terrain

The same vehicle experiment was performed with BulletSim (20130515) and the results are shown in the below graph. The basic turning of the vehicle was accomplished while the turn control was active. The performance differences are how the vehicle acted turning that turn.

While SL and ODE kept the vehicle pointing in the direction of movement while turning, BulletSim allowed the vehicle to point in a different direction from movement. The major difference is allowing the vehicle to turn more than its movement resulting in 'drift' where the vehicle moves sideways. This sideways movement is seen in the large value for 'Y' velocity and the falling off of the 'X' velocity. Another difference is the drop in absolute speed.

While this drifting effect is possibly more realistic (especially at high speeds), it means that BulletSim vehicle movement does not correctly model the SL vehicle model.

#### Addition of Linear Deflection (June 2013)

In June 2013, Vegaslon submitted code to compute the linear deflection factor for vehicles. This addition greatly improves the velocity and stability of the vehicle as shown in this graph:

BulletSim vehicles still exhibit significant drifting but the forward speed and smoothness of movement is greatly improved.