JTang, on 10 March 2013 - 02:46 PM, said:
The code has been changed so that outside cameras will not shake along with the cars.
Jijun,
Now this was an unexpected surprise!
I think you'll have to go back to the drawing board on this one. I don't know what your background is, so I will assume there is a little bit of mathematics in it, so please take a look at this: Damped Harmonic Oscillator
Take a good look at the graphic entitled "Underdamped Oscillator". If the mathematics is beyond you then look at the graphic, and notice that it is sinusoidal. This is VERY unlike what you have modeled which is mostly a rapid pulse, square wave. It should be easy to use the values of a low frequency sine wave as your jitter offset. Typically, the frequency is LESS than 5 Hz, this means 5 cycles per second. Your jitter is far higher than that! Since you are trying to accomplish this in real time I suggest a lookup table of pre-computed values (either as part of the constants or computed once and only once when runactivity.exe starts up) for the movement (X axis jitter in the sim) and damping. Damping just means that instead of steady state oscillations you can have a reduction in both the frequency (5Hz down to 0Hz) and amplitude going to zero. This would be far more realistic and less vertigo (dizziness!) inducing.
So instead of the abrupt, +/-1 changes along the X-axis, you would have progressive values as seen here:
http://www.grc.nasa.gov/WWW/k-12/airplane/Images/tablsin.gif
Note that you have a progressive change in values. To speed things up you can step through the table by 10 or 20 degrees (BUT, remember the faster the change, the more jitter you will have!). For negative values, just change the sign of what is in the table (starting from a zero angle). So in practice you index from 0 to 90 back to 0, etc. To lower the amplitude you would index from 0 to 90 to 0 but divide the values given for each angle by 2 (this is just an example) etc.
Again, since these values are pre-computed, you do not have to calculate them in real time and is therefore VERY fast. If anything it is simply a matter of indexing into the table/array and performing simple arithmetic to get the desired result. With this method the different jitter rates could be applied to each engine car, but I think it is important to go easy on the amplitude and frequency.
Your idea Jijun is a very good one and most practical and "realistic" if done with a little care.
Hope this helps a little,
Eldorado