Driving – Tony Fendall http://blog.tonyfendall.com Sun, 10 Apr 2016 09:45:34 +0000 en-NZ hourly 1 https://wordpress.org/?v=4.4.2 Accurate Car Simulation in Flex http://blog.tonyfendall.com/2010/02/accurate-car-simulation-in-flex/ http://blog.tonyfendall.com/2010/02/accurate-car-simulation-in-flex/#comments Thu, 04 Feb 2010 23:20:13 +0000 http://blog.tonyfendall.com/?p=31 Continue reading Accurate Car Simulation in Flex]]> car_top2 The demo below came from a technical challenge I set myself a few weekends ago.  I often like to set myself small challenges like this… I guess it’s kind of like doing a cross word puzzle.

The challenge this week was to accurately simulate the movements of a car in 2D.  Most people don’t realize this, but when a car turns it is rotating about a point outside itself, and that point is perpendicular to the wheels.  It’s a little hard to explain, but if you check out the demo below then it all should become clear.

This app was challenging mainly due to the geometry involved, and I definitely had to scratch my head for a while before I remembered how to rotate one point around another.  I’m pretty happy with how it turned out however.  It was definitely an afternoon well spent.

Try it Out:

The full source code is available here. Feel free to take it and use it in any way which us useful to you.

A few people have me why I didn’t allow you to control the car using the arrow keys.  The answer is simply that this demo is more impressive when you can appreciate the analogue nature of car steering.

]]>
http://blog.tonyfendall.com/2010/02/accurate-car-simulation-in-flex/feed/ 2