Animating a model aircraft along a spline curve

Around a year ago Paul van Dinther shared a cubic spline curve that identified a path through the Grand Canyon.

Colin Hazlehurst (who has created items such as Captain James Cook’s exploration of Australia) was working on software to animate model aircraft in Google Earth and thought it would be an interesting exercise to make his Spirit of St Louis model fly along Paul’s curve.

GrandCanyonThumbnail

This KMZ file shows this in action, and illustrates the following (in Colin’s words):

  • The model moves in turn to each set of coordinates (longitude, latitude, and altitude) defining the LineString. The duration of each AnimatedUpdate is determined by calculating the distance between points and dividing this by the pre-set speed of the model.
  • The roll and tilt of the model are calculated from the changes in heading and altitude respectively between successive pairs of coordinates.
  • A Camera ‘follows’ the model with a pre-determined offset, defined in terms of heading, range, and tilt relative to the model. These values identify the location of the Camera, but the Camera also has a tilt setting which varies according to the pitch of the model; if the model is climbing, the camera tilt is reduced; if the model is descending the camera tilt is increased. This has worked fairly well in this instance, but I notice that at one point the Camera bounces off the wall of the canyon. This might happen when you view the kmz, and I would suggest trying different aspect ratios (width to height) of the Google Earth window.

I thought at first it wouldn’t look right to fly a model aircraft along a spline curve; it didn’t seem to be the way that aircraft flew. I realise now that this was because my first experiments drew splines on too large a scale, with many miles between interpolation points. Paul’s curve is on a much smaller scale, making for correspondingly small adjustments to the flightpath.

Along with the file above, you can also watch this YouTube video to see it in action.  Nice work, Colin!

About Mickey Mellen

Mickey has been using Google Earth since it was released in 2005, and has created a variety of geo-related sites including Google Earth Hacks. He runs a web design firm in Marietta, GA, where he lives with his wife and two kids.



Leave a Reply