Pan Follow Camera with Keyboard
Some games just require a camera to follow the ground plane in an isometric style. I have done this with mobile games using the touch screen, but at present that requires some coding. However, for the desktop, this can be achieved quite simply using a few simple Actions and the Game Creator Follow Camera.
For this Tutorial, in addition to Game Creator, you will need the following:
  • Move by Distance Action from the Action Pack 1 for Game Creator
  • On Key Being Pressed Trigger from the Game Creator HUB.
These can be found at:
To start, once you have created your terrain or ground plane, you need to decide on the camera angle that suits the style of your game. This is controlled by the placement of two 3D cubes, and you can also adjust them later to suit.
Add a Game Creator Camera Motor and set this to Follow. But before we set the parameters in this motor, we need to add our two Cubes. Add the first cube above the terrain and approximatley where you want the camera to start from.
Add the Second Cube forward and down from the first.
Then child the Second cube under the first, so when the First cube is moved, so will the second, but maintain its distance and perscpective.
Next, in the Follow Camera Motor, set the Anchor to Game Object and select the Parent Cube, and set the Look At to Transform and select the child Cube.
You can adjust the view angle by dragging the second cube outwards, and the first cube up or down.
Once you have the angle how you want it, its time to make it move. The settings here will depend on your scale, and for this demo I have used an extremley large terrain. The smaller the terrain or ground plain, the smoother it will be.
Unclick the Mesh Renderes for both Cubes, so they are not seen, nor is time wasted rendering them
Now we add a Trigger into our scene. Select the On Key Being Pressed that you downloaded from the Game Creator HUB. Set it to W (or whatever Key you want for forward), and add an Action. Within the Action, add the Move Object by Distance from the Action Pack 1, and add the Parent Cube to the Game Object.
Select x Axis to Move and set your value. I have set to 100, but on a smaller terrain, 10 should be okay. You can experiment with these later to get your desired effect. Also set the Easing to Linear, or you will get some interesting effects.
The last thing to do is to duplicate the Trigger with Action, Change the Key to S, and make the move value in the Move Action negative. Now press play.
My scene is a bit slow as the Terrain I used was extremely large. A smaller terrain or floor plane will be a lot smoother. You can also tilt the camera more to provide an isometric view of a 2.5d Game.
You can also duplicate the Trigger twice more, set the keys to A and D, and move on the y axis. This will move your camera sideways.
Have Fun!
Last modified 1yr ago
Copy link