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 / Multiple camera problem + workaround

Author
Message
Christian B
18
Years of Service
User Offline
Joined: 12th Jan 2006
Location: Montreal, Canada
Posted: 29th Jan 2006 16:40
In designing a mission editor I had to use multiple cameras (up to 3 active at one time, many more in total that get made/deleted as time advances). I noticed sometimes the main camera would move instead one of the other cameras. Here what the original code looked like:



For some reason, sometimes some of the functions following dbMakeCamera would affect camera 1 instead of camera 3 (which is what nb was equal to). I modified the code to this :



and all of a sudden everything behaved as it should. In theory shouldn't both blocks of code produce exactly the same result?

I know the code I provide is not enough to reproduce the bug. The bug was very random and would happen after I created/deleted cameras a few times.

I'm just throwing this here to see if other people experienced similar behaviour when using multiple cameras, maybe give the devs something to look into and most of all give a workaround to people who might be having the same problem.

Thanks!

---
http://christianboutin.com
Vlad
18
Years of Service
User Offline
Joined: 5th Oct 2005
Location:
Posted: 29th Jan 2006 19:17
Quote: "and all of a sudden everything behaved as it should. In theory shouldn't both blocks of code produce exactly the same result?"


From what I've experienced, not really. You need to set the current camera (like you did) and have all code except the positioning code included in the game loop.

I guess that's why dbSetCameraPosition is there.

V

The only lazy people that can complete games are genius. You don't look like a genius, so you better stop being lazy.
Support your local Riker 9 Chapter.
Christian B
18
Years of Service
User Offline
Joined: 12th Jan 2006
Location: Montreal, Canada
Posted: 30th Jan 2006 03:04
I find it weird that in code snippet #1 I still expressly mention camera "nb" for all the transformations but it doesn't perform as expected. Isn't the point "dbSetCurrentCamera(nb);" that you don't have to specify which camera is affected everytime you make a transformation? But that you can choose to specify it everytime

Quote: "I guess that's why dbSetCameraPosition is there."


dbSetCameraPosition? What's that? Haven't found that in the docs or in the .h

In other news I'm having another camera problem. A camera will sometimes reset when I create a primitive object (or any object).

I'm keeping track of the camera's datablock using dbGetCameraInternalData ( ); and sometimes when I create a triangle using dbMakeObjectTriangle, internal data of the camera changes, and on the next frame the camera's position will be back to 0,0,0.

Right now I have to backup the camera's data as such

, make my triangles and then restore the data like this

so that the camera doesn't reset. Good enough for a quick workaround for now.

Using 1.1.1 BTW, which I should always mention (1.1 doesn't work with VC6 and I only have that and VC2005)

---
http://christianboutin.com

Login to post a reply

Server time is: 2024-05-17 12:12:42
Your offset time is: 2024-05-17 12:12:42