When I read about Delphi 3D in “FireMonkey Development for IOS and OSX with Delphi XE2” I was excited about the described ability to move the “camera” around in the 3D scene. Given that my then 11 year old grandson had whacked together a credible solar system scene in an afternoon moving the camera seemed to offer great possibilities.
It was not until Christmas 2015 however that we really tried to do this. Initially all went well and it is easy to move or pan the camera for key strokes or even get the camera to “target” or follow an object.
We then introduced a “Heads Up Display” to the camera with coordinates, speed and a “gun sight”. My grandson now 13 with his own “academic” copy of Delphi declared that this was a “First Person Shooter” game mode and adjusted the Key codes to suit.
While moving the camera along the lines of left arrow >> X := X + 0.05 was easy what we really needed was the “view port” to move forward in whatever direction it happened to be pointing and make use of the graphics engine so that the screen looked credible.
Not so easy but I can now offer code libraries via GitHub that reduce this to a couple of lines of code.
procedure TForm1.Form3DCreate(Sender: TObject); begin FlyCam:=AssignFlyingCameraToForm(Self,5,26,-29); FlyCam.StepFormat:=true; FlyCam.Speed:=0.1; end;
I will explain the implementation in later posts