Ok:
1) Decide which keys on your keyboard you?ll use for your cameras. Ex: F1, F2, F3.
2) Go tho the input.cfg file on the root directory of your project, and put, for example:
#new actions
Action CamZelda
Action CamFixed3rd
#new keymappings
KeyMapping KeyF1 CamZelda
KeyMapping KeyF2 CamFixed3rd
Then, inside of your character controller script, put at the top of all:
#include "cameraSystem.gsl"
Attention: you write the
include this way if your player.gsl is in the same folder as the cameraSystem.gsl. If it?s in another folder you?ll have to use the syntax for navigating folders, like, for example:
#include "../../../scripts/cameraSystem.gsl"
Then, put a variable along with your variables (probably at the top, too), like:
int camMode = 1;
Then, inside of Initialize() function, put:
initCameraSystem();
Down the script, inside of the HandleEvent() function, put events like:
if(event == "Input"){
if(params.stringValue == "CamZelda" && params.floatValue > 0.5f){
camMode = 1;
return true;
}
if(params.stringValue == "CamFree" && params.floatValue > 0.5f){
camMode = 2;
return true;
}
}
Then, inside of SetupCamera() function, put something like (the names of the parameters inside parenthesis may differ in your script. it depends on how you named them):
camSys_setupCam(object, cam, camMode);
And that?s all.
Remember: you?ll have to customize the values for the cam. position relative to the player (= local coordinates) inside of the cameraSystem.gsl, to fit your game.
They?ll be inside of the part where I created the initCameraSystem() function. Like this:
void initCameraSystem()
{
//zelda
zeldaCam.localPos.Set(40.0f, 65.0f, -45.0f); //customize values to fit your game. You must know your character?s height etc.
zeldaCam.localFocus.Set(0, 0, 0); //customize this if you don?t want the focus at the character?s pivot/origin.
zeldaCam.up.Set(0, 1, 0); //customize this if you don?t want the camera?s up direction to be Y+.
//free, third person
freeCam.localPos.Set(0.0f, 20.0f, 30.0f); //(same idea for this camera)
freeCam.localFocus.Set(0.0f, 15.0f, 0.0f); //(same idea for this camera)
freeCam.up.Set(0, 1, 0);
}
Hope this makes sense now.
Try to understand the purpose of each step before doing it.
Cheers.