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.

Newcomers DBPro Corner / Can't Switch Cameras

Author
Message
Jonk
18
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 19th Nov 2011 15:27
I am trying to write a program with two cameras. one viewing the 3d world from a first person point of view similar to an FPS game.

The other being a static camera that just watches the player from a fixed perspective.

The problem that I am having seems to be with the actual switching routine. If I REM the line that reads "make camera staticcam", then the camera routine for the first person camera seems to work as intended.

Is there any bright sparks out there who could suggest some code that will make the static camera routine in the program work correctly too?





"There are no perfect ideas only perfect intentions"
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Nov 2011 17:40
I'm not sure why it's not switching (seems to be working ok for me) but the SCANCODE() command was only designed to tell you which numbers to use for the KEYSTATE() command. SCANCODE() only returns the lowest numbered key being pressed so it cannot detect multiple keys. Really the most useful thing SCANCODE() can do is to detect when no keys are being pressed. KEYSTATE() on the other hand can detect multiple keys.



IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Nov 2011 22:24
There's a fundamental misunderstanding of what SET CURRENT CAMERA does in the code.

What it does: Sets the default camera for those commands and functions where you do not specify a camera number
What it does not do: Control the camera draw order, or specify which camera views should be rendered.

What is happening in your code is that one camera is being rendered to the display, then the second camera is being rendered over the top of it.

The fix for your code is to use a single camera, not multiple cameras, and to change that camera's position/orientation depending on which camera mode is selected by the player/user.

Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 19th Nov 2011 22:33 Edited at: 19th Nov 2011 22:36
Yeah, I was going to say the exact same thing, you can probably just make some constants for the static camera position or something. Then when they press 2 position the camera there and point it.

(You don't need to use constants, I just figured it would be easier to remember than coordinates.)

-------------------------------------------------------------

Login to post a reply

Server time is: 2024-05-20 05:17:40
Your offset time is: 2024-05-20 05:17:40