Racing game: Change of the perspective

Hey guys! I am a newbie at jMonkey and in game development in general.
So my project at the uni is to program a small addition to an existing racing game.
I’ve chosen to program different driver views, like far behind the vehicle, near and a drivers perspective without the vehicle body to be seen.
I try to understand what steps are necessary to make this work:

  1. map a key for the perspective change
  2. initialize the controls
  3. define a starting/default perspective
  4. define the other perspectives
  5. write a IF loop, defining when the perspective has to change, how to change and going back to the default perspective after the last one. also update screen after every change.
    And that is the part where I’m stuck - the if loop (I think)

So is my general idea of how to make this work correct? Or did I forget something?

For simplicities sake i’m just gonna deal with Camera Nodes for now, but this can be swapped for your own camera implementation, and possibly ChaseCamera for the 3rd person views. Up to you

Either have 1 Camera Node, and different Settings for it, or 3 different Camera Nodes. Put this into an array, and then keep an index into it as a member variable.

If you define an ActionListener for some event, like Press the Right Arrow, this updates the index, and chooses the next Camera Node. Always check if you are above or below the bounds of the array before you choose it! if at the end and going right, then set it to 0, if you are at the start and moving left then set it to camNodeArray.size () - 1.

Then you can either go straight to it, or interpolate between the different views (by setting a boolean variable, and then checking this in the update loop).

(sorry if this doesn’t specifically answer your question)