Hi,
I have a Formula 1 collection in the Sports (moderated) section of the
GE Community boards for last year. One of it's features was a Flying
Lap of each of the circuits which unfortunately doesn't work as
designed any more as you can't set the Tour range to <150m any more in
GE 4.3.
Because of that I looked towards the Plugin to give me back that
functionality - and improve upon it. Rather than just make it specific
to what I needed I decided first to make it fairly generic as Touring
linestrings seemed to be a popular requirement and one which has been
discussed many times in this group and the solution I have may be of
use to others.
I do have a few bugs to iron out, which I'll touch on towards the end
of this post, and also a fair bit of tidying up to do - but in the
meantime let me outline the approach I have taken.
http://www.thekmz.co.uk//GEPlugin/pathtour/v1/path_tour_v1.htm
(beware ... it's quite busy as it's really a test platform but all
will become clear ;) )
(Those familiar with Roman's Driving Simulator will recognise alot of
the structure although there are some fundamental diffences in how it
works).
My Linestring KML contains only a linestring - the example being of
Silverstone (home of the British Grand Prix)
There is then an option to tour at a fixed speed. This is the speed
with which you actually cover the ground. There is a routine that
adjusts the timing on each TICK to ensure this is the case and the
speed displayed at the foot of the form is the actual speed you are
travelling.
In the example however I have added the speed for each segment by
using the Altitude part of the Coordinates. If the speed on the form
is set to 0 the code will use the Altitude (in m/s) as it's speed.
This was, imo, a good use of a spare slot but when I add g-force and
gears in I will have to use a different method. (You can open the KML
in GE and set it to Extrude relative to ground to see a speed map of
the circuit).
The Model KMZ is a Ferrari with The Stig at the wheel.
You then Initialise the lap. It doesn't do OnLoad so you can load your
own linestring and/or model.
Bugette 1: When you initialise and Alert comes up says the KML has
loaded. I wish I didn't have to do that but if I don't it it tries to
parse the KML before it's finished loading. Help to sort that would be
appreciated.
Once initialised you should then be sitting on the start line ready to
go. Again sometimes, if the Plugin is being a bit slow it doesn't
always get there. Hit init again if that's the case.
You can then Start the tour.
Note: If the first and last coords in the linestring are the same (as
it is in the example) the tour will loop continuously.
By default the LookAt follows the linestring and you can change the
Altitude, Range, Tilt, and Rotation as the Tour is running. (These are
OnClick not Mousedown/up so you have click multi-times).
You can change to the Camera as well but remember that the 4 values
mean slightly different things when applied to a camera. (Altitude of
at least +1 is best here).
Camera is something I'm going to work on some more as it also has Roll
which I have added in another test file and works really well with a
motorbike as the whole scene, and bike, rolls as you go into a
corner :)
You can hide the Linestring or Model and also toggle the terrain. When
the Range is really small I turn the terrain off as the model jumps up/
down too much - another thing I'd like to fix somehow.
Within the code I've added just about everything to the TourSimulator
object as a want to be able to have more than one linestring/model
running at the same time and the only thing common to them all would
be the SpeedFactor than increases/decreases the speed of the whole
set.
Now for some other bugs....
If I zoom-in (Range) to around ~<=6m and then pause the sim not only
pauses but the view alters as well. This doesn't happen at larger
ranges and becomes even more pronounced at lower ones. How do I stop
this happening? My first thought is that it is something to do with
the Tilt-on-Zoom thing but am not sure.
If I'm close the sim seems very smooth but if I zoom out to a 100m say
it seems a bit jerky. With each TICK I change the heading and speed as
a % of the segment distance and have tried it with a fixed speed and
also without the speedAdjustment (the part that adjusts to real-time)
but get the same results. I happy-ish as it is as I intend to run it
from an in-car prospective but would dearly love it to be as smooth as
the Milktruck.
For info - my linestring was created using Bezier Splines which is how
I got it how it is ... allowing me to get the car to follow an exact
path with a smooth curve.
Anyway thanks for reading - comments welcome
Regards
Nymor
(PS I hope you all had a great New Year and have an even better 2009.
It's the job market for me :? )