Oct 14, 2009
I work for a company that produces accident reconstruction software. We have a vehicle dynamics program that realistically simulates the motion of a vehicle (position and rotation of car and steer angle of individual wheels, etc).
View 2 Replies
All the positions of the car are stored into an array called AMTN. The vehicle dynamics program can calculate positions at time steps finer than .005 secs (200 FPS).
I need to represent this data in real time, and so far I have not been able to accomplish this. I have tried doing this in Excel/VBA, VB6, and am currently trying to do it in VB.NET.
I have used a whole plethora of timers and counters as well as different methods of drawing lines on graphics linked to images linked to picture boxes, etc. My animation program writes/clears the screen correctly, but there is clearly some sort of lag in either the timer or writing method. I have scaled it down to 25 FPS and there is still a lag.
Here is an example of what I am trying to do with each tick of the timer:
Sub Timer1_Tick1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
With each tick of the timer, the graphic is cleared, lines representing each side of the car are drawn onto the graphic, and the picturebox is then assigned to the image, which is linked to the graphic. This is just like how your asteroids program works.
Do I need to change my method? Should I use sprites? Or would it be better for me to create images/bitmaps of the animation beforehand and simply flip through them with a timer?
I'm thinking that creating the images beforehand might work because I do not have to calculate the vehicle's position as it is predetermined by my AMTN matrix.
if there is a more efficient way of displaying my vehicle on the screen that would allow for greater FPS, etc.