May 23, 2012, 04:20:23 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: Player camera control questions-  (Read 1896 times)
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« Reply #15 on: August 27, 2008, 04:58:15 PM »

You are the man! Smiley
Logged
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #16 on: August 27, 2008, 05:30:57 PM »

No, pixel. I?m like you + one year more of GameCore (actually it was BV). Wink

I?ve replaced the cameraSystem.gsl file attached. Only a correction in a comment whose sentence was making no sense.

Edit:
This idea of creating "systems", "managers" or whatever you call it, in separate .gsl files (which don?t have DynamicsAdvance(), AnimAdvance(), Initialize() nor SetupCamera()) is not mine, nor new, but it?s very good, i think. Because this way you can make scripts with many useful functions, variables etc that are generic, so can be reused almost without changing pieces of it (if you don?t want to). And better of all, i think, makes your controller scripts shorter and less cluttered. Mine were always enormous and complex, because I?ve used to put everything in only one big .gsl file.
This is very bad for reuse, because even copying and pasting code I?ve already done before, to speed up my process, I have to go cleaning with a lot of attention the stuff I won?t need in the new script. Fixing parts, fixing parts.

This way of using #include (or any other we can have) is much better I think. Because when I get to make a new character script for a 3rd person action demo/game-prototype, I just find the systems I?ll need, them I put something like:

Code:
#include "BasicMeleeCombatSys.gsl"
#include "BasicCameraSys.gsl"
#include "BasicMissionsSetupSys.gsl"
#include "BasicNPCBehavioursSys.gsl"

And if I?m making a ball object that will only need the camera, for example, for a mini-game inside the game, I just call in the ball.gsl:

Code:
#include "BasicCameraSys.gsl"

and nothing more. Like plug-ins in an off-the-shelf software.
Just an idea. Smiley
« Last Edit: August 27, 2008, 05:52:43 PM by grubert » Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« Reply #17 on: August 27, 2008, 05:49:25 PM »

I haven't tested the demo enough but could you explain what it does? I see in code that F1 and F2 switches between zelda cam and another cam but nothing happens Smiley Nothing is moving but i know it was stated it was a static camera. But is it supposed to switch?
Logged
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #18 on: August 27, 2008, 05:57:12 PM »

Yes, it?s supposed to switch. But there?s something missing in this project that is not allowing me to catch the keypresses. I don?t know if it?s a bug with this specific project (I have other almost the same where the keypresses work ok), but I didn?t manage to find the "missing piece of logic". I?m gonna search for the bug again here. If you want to search for it too, I?d be happy. I didn?t find it.
Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #19 on: August 27, 2008, 06:13:04 PM »

I think it?s a bug with this project. I?ll try to setup another project from scratch to see if it works.

Edit:

I created another project and tested and nothing again. No keypresses working.
Or it?s a bug or a logics fail that is not accusing any error, so it?s harder to find. I?ll take a break now. Later on I?ll check it.
But you can try to pick only the cameraSystem.gsl script, put it into another project of yours, link using the #include, put the needed stuff in your gsl and try it, to see if the same thing happens. I?ll do this later.
« Last Edit: August 27, 2008, 06:24:43 PM by grubert » Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #20 on: August 27, 2008, 06:34:26 PM »

It worked completely OK in other project here (the one with the sharks).
Oof!  Grin

I think we can expand on this idea and make some basic systems (or managers) for the dudes here.
This cameraSystem.gsl can be expanded to have cameras from F1 to F8. Like I?ve done in the Flightsim.
If I have a spare time... Smiley


Cheers.
Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
zknack
Full Member
***
Posts: 207


View Profile
« Reply #21 on: August 27, 2008, 08:22:47 PM »

Nothing working at all on this yet for me :-/

Logged
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #22 on: August 27, 2008, 08:29:45 PM »

Did you try it in another project?

Remember you have to add Actions and Keymappings for the keys you want to change the cameras, in the input.cfg file.
Then you also need to have the proper events inside of HandleEvent() for these keys. And at least one camMode integer variable in your controller script.

Mine here is working with other projects. I?ll expand it to have some 5 cameras.
Is there any other type of camera (not too complex) that you would want?
Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
zknack
Full Member
***
Posts: 207


View Profile
« Reply #23 on: August 27, 2008, 11:02:36 PM »

Not sure I'm following 100% Grubert- sorry mate, but my 90+ hour weeks lately are starting to melt my brain I think,
could you give me a step by step on this one?
Logged
grubert
Full Member
***
Posts: 183


Everybody is very nice, but my jacket disappeared.


View Profile WWW
« Reply #24 on: August 27, 2008, 11:38:26 PM »

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:
Code:
#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:

Code:
#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:
Code:
#include "../../../scripts/cameraSystem.gsl"

Then, put a variable along with your variables (probably at the top, too), like:

Code:
int camMode = 1;

Then, inside of Initialize() function, put:

Code:
initCameraSystem();

Down the script, inside of the HandleEvent() function, put events like:

Code:
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):

Code:
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:

Code:
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.
Logged

my portfolio and weekly posting:
http://athossampaio.blogspot.com
Pages: 1 [2]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!