Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Camera problem. Should be simple but running into trouble

Author
Message
tneva82
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 7th May 2008 09:32
Downloaded and installed GDK yesterday. Got fighter moving around in very short order(real plug&play 3d graphics!). Then decided to make quick&easy avoid walls flight "game". Problem: Camera should be slightly behind and up the fighter all the time. However all attempts to do that have failed big time resulting in plane spiraling out of screen if I use up or down keys and left and right don't look that good either.

Here's relevant code pieces. I have tried to use several functions to get the effect but none have done the trick so far.



So. Any idea what I'm doing wrong big time?
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 7th May 2008 15:41
I can see your problem. It's quite hard to describe. what youve got is not the camera following where the fighter goes, but instead following what the fighter does. for example, the camera rotates up when the fighter does, but this system would onl;y work if they were in exaclt ythe same place for a first pewrson veiw. what you want is a third person veiw. It's best to describe graphically:
Before any arrows:
fighter camera
- -
that works fine.
but when you press up arrow:
fighter camera
\ \
notice that the camer ai not pointing at the fighter, but parralell to where the camera is pointing.
tneva82
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 7th May 2008 18:54
Yeah I realised that myself. I can get it almost working(atleast fighter won't spiral out of control) by simply positioning it to fighter's position with slight Y&Z co-ordinate alterations but that way when I turn around I'm staring front nose of fighter. Not good enough! Need a way to rotate around it keeping fighter effectively "frozen".

Hum. Tricky tricky. Maybe I should just say screw it to this point of view and just go from "inside cockpit" view. Wouldn't have to worry about camera that way.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 7th May 2008 20:37
I thought of a wuite long winded way of doing what you orgininally wanted:

basically the way this works is it temporarily moves the fighter backwards 5 (you can change this number) and then puts the camera there, then moves the fighter back before you notice.
If this code doesnt work straight away, read my comments and change accordingly.
tneva82
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 7th May 2008 21:02
Hum. Almost perfect(just had to add up and down move to get it look slightly downward to fighter). There's just one bizare effect. Keep pressing down(or up) key and eventually fighter flips over. That's not pretty effect and would probably disorientate player in middle of dogfight if this would be for fighter game .

I'll keep trying to figure out how to get that(and figure out something to performance issues. Is my computer really THIS bad?). Thanks for the help.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 7th May 2008 23:15
Check its angle. If its too high or too low, don't change pitch.

I AM THE ALL MIGHTY CORNHOLIO! Do you have TP for my bunghole?
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 8th May 2008 09:15
does it graddually point up more and never come back down?
you could add a sort of self-righting thing so it goes back to 0 rotation eventually (if it's up, pitch down, if its down, pitch up). Or you could make sure the camera follows it when it rotates.
tneva82
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 8th May 2008 12:36
No it goes nicely for a while and then suddenly flips upside down.

Login to post a reply

Server time is: 2024-09-29 19:16:57
Your offset time is: 2024-09-29 19:16:57