Accurately Simulating Car Movement in Flex
When I find time (which is increasingly less often), I always like to set myself technical challenges to solve. I enjoy the challenge of it, and every so often I actually produce something which someone else could find useful.
In the last couple of days I have been trying to accurately simulate the movement of car (two steering wheels, and two fixed wheels). This is more complicated than it first appears because, when the car is turning, it is actually rotating around a point which is outside itself. The diagram to the right should help to show what I mean.
Getting this form of motion to work properly involves some complicated co-ordinate geometry to make points rotate around other points across multiple frames of reference. It took me a while, but I finally managed to get it working today. You can check out the result below
id="Driving" width="600" height="600" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
CLICK HERE TO VIEW SOURCE