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 between cameras

Author
Message
jerryd
7
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 10th Mar 2013 06:18
DarkBasic forum,

I have a very simple program that works and now all I want
to do is switch between 2 different cameras(see code snipet).
I set up the 2 cameras and then execute SET CURRENT CAMERA 1
but camera 2 is all I get.



AUTOCAM OFF

MAKE CAMERA 1
POSITION CAMERA 1, 0, 0, -500
COLOR BACKDROP 1, RGB(0,0,0)

MAKE CAMERA 2
POSITION CAMERA 2, 0, 0, -200
COLOR BACKDROP 2, RGB(255,0,0)

SET CURRENT CAMERA 1


What am I doing wrong?

jerryd
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 10th Mar 2013 16:37 Edited at: 10th Mar 2013 16:38
[X = Camera Number]

When you use 'MAKE CAMERA X' You must immediately 'SET CURRENT CAMERA X'

A newly created camera is not automatically active...

Don't forget to perform a check 'CAMERA EXIST(X)' before performing any camera actions...

Example:


Hope that helps...

jerryd
7
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 11th Mar 2013 00:02
DarkBasic forum,

Thanks for the replies so far but I'm still having the same problem.
Here is my whole program that should compile and run. Maybe someone will see what I'm doing wrong.

I haven't figured out how to do a "Code Snippet".

Sync on : Sync rate 30
Cls 0
Autocam off : Backdrop On

Position Camera 0, 0, 0, -500
Set Current Camera 0
Color Backdrop 0, rgb(0,0,0)

Make camera 1
Set Current Camera 1
Position Camera 1, 0, 0, -200
Color Backdrop 1, rgb(255,0,0)

Make Object Cube 1, 100

Position Object 1, 0, 0, 0

Set Current Camera 0

do
if inkey$() = "0" then Set Current Camera 0
if inkey$() = "1" then Set Current Camera 1

`update the screen
Sync
loop

jerryd
pcRaider
13
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 11th Mar 2013 01:12
This is example-code of set_current_camera in helpfile.

use cursor-key and z,x key.
jerryd
7
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 11th Mar 2013 02:40
pcRaider,

Thanks, I did see that example but it has both cameras on the same screen at the same time. I want to turn off 1 camera and turn on the other one. This works but that seems like a lot of extra code and time.

[/code]
do
if inkey$() = "1"
if (camera exist(2))
delete camera 2
Make Camera 1
Position Camera 1, 0, 0, -500
Color Backdrop 1, rgb(0,0,0)
endif
endif

if inkey$() = "2"
if (camera exist(1))
delete camera 1
Make camera 2
Position Camera 2, 0, 0, -200
Color Backdrop 2, rgb(255,0,0)
endif
endif

`update the screen
Sync
loop
[code]

jerryd
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Mar 2013 03:15 Edited at: 11th Mar 2013 03:16
Quote: "Set Current Camera X"


Also for the love of cheesecake, stop using -200 after -500, and place the camera somewhere else or move it somewhere else...

jerryd
7
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 11th Mar 2013 03:28
MrValentine,
Don't like my camera Z positions Huh. I'll change then if I have to post this code again.

jerryd
MrValentine
AGK Backer
9
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Mar 2013 03:44
I just feel it is the reason you are not seeing any difference, are you using just this code or is there anything more to this application? if it is JUST that code, then it is no wonder you see no change...

pcRaider
13
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 11th Mar 2013 03:54
It uses one camera and changes a direction and position.

jerryd
7
Years of Service
User Offline
Joined: 20th Feb 2013
Location:
Posted: 11th Mar 2013 04:25
DarkBasic,

I got it to work and now see a difference.

Thanks for all the replies. I learned a lot.

I'll be back with more questions.

jerryd

Login to post a reply

Server time is: 2020-12-02 19:39:28
Your offset time is: 2020-12-02 19:39:28