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 / How to block camera from going upwards or downwards ?

Author
Message
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 25th Sep 2009 19:02
Hi, im new on forum and i am trying to do a FPS Game using Visual C++. Ive know a little bit about C++, but dont know much of the DB functions.
I saw the demo.cpp of Dark Dungeon sample, that came with Dark GDK and the use dbMoveCamera() to move camera and character. But using this the camera goes anywhere in the map, and i dont want it to go upwards or downwards... So is there any way of blocking this ?
I used dbMoveCameraLeft() and dbMoveCameraRight() to move camera sideways, but there is no function as dbMoveCameraFront() so, please help me on this...
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 25th Sep 2009 22:34
save old camera angles
rotate camera to look forward
dbMoveCamera()
rotate camera back to what it was
dbSync();

bloodmage2
15
Years of Service
User Offline
Joined: 14th Jun 2009
Location:
Posted: 25th Sep 2009 23:08
you could run a check for the camera y, if it is higher or lower than what you want it to be, move it to where it needs to be,
something like

if(dbCameraPositionY() > highValue) dbPositionCamera(dbCameraPositionX(), highValue, dbCameraPositionZ());
if(dbCameraPositionY() < lowValue) dbPositionCamera(dbCameraPositionX(), lowValue, dbCameraPositionZ());

-to the optimist, the glass is half full. to the pessimist, it is half empty, to the engineer, it is twice as big as it needs to be.
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 25th Sep 2009 23:10
I Have something like this:



But when running the application and if i press W, the camera just keeps going up and down, just like if it was always rotating the camera on X axis
zydeoN
15
Years of Service
User Offline
Joined: 25th Sep 2009
Location:
Posted: 26th Sep 2009 00:59
Solved! Just had to use:

Login to post a reply

Server time is: 2024-10-01 14:35:31
Your offset time is: 2024-10-01 14:35:31