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 following object and rotate.

Author
Message
1beginner1
15
Years of Service
User Offline
Joined: 28th Jun 2009
Location: Belgium
Posted: 30th Jun 2009 19:08 Edited at: 1st Jul 2009 12:00
Hello I made a little maze you can control a object with your arrow keys through the maze. The camera is located a little behind the object. The first picture shows how I want my camera rotate. The second picture shows how it is now. How can I get it like in picture one?



Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th Jun 2009 22:22 Edited at: 30th Jun 2009 22:27
Try messing around with the following function:



You put this in your loop.
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 1st Jul 2009 01:02
Alternatively, you can avoid the 'black box' of the db commands and use some simple trig. This will produce a more rigid camera than dbSetCameraToFollow will ( Though you could modify this to make it smooth ).

Some (kind of ) psuedo code, it should compile if the vars are declared:


1beginner1
15
Years of Service
User Offline
Joined: 28th Jun 2009
Location: Belgium
Posted: 1st Jul 2009 12:10
Thanks both of you
I used matty his code because I don't know how to declare my vars. But the movement is still not 100% ok. When I turn my object the camera turns to but when i do a spin of more then 180 degrés it starts to turn in he other way. When i do 360degrés it is back good. And i start always over.

This parts of my code I changed. In the first part I changed by left and right the dbMoveObjectLeft/Right in dbTurnObjectLeft/Right. So my angles becomes different. I deleted all my code about my camera and past the code you see in part 2. Both are in loop.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Jul 2009 18:14
Try this:




I used this in my loop:



And discovered that dbTurnObjectRight and dbTurnObjectLeft do some strange things with the Y angle, those commands must be used for something different.
1beginner1
15
Years of Service
User Offline
Joined: 28th Jun 2009
Location: Belgium
Posted: 2nd Jul 2009 12:05
Thanks Matty

It's working great now. Exactly like I wanted it to work.

Login to post a reply

Server time is: 2024-10-01 06:04:10
Your offset time is: 2024-10-01 06:04:10