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 / Panning a camera

Author
Message
anoon
21
Years of Service
User Offline
Joined: 30th Oct 2002
Location: United States
Posted: 7th Nov 2002 21:28
I am attempting to write my first program with the DBP trial. This is what I want it to do:

Load a piece of geometry I modellled: SUCCESS
Implement mouselook: SUCCESS
Dolly camera off keypress: SUCCESS
Pan camera off keypress: FAILED

I don't see any Panning controls under camera control in the help file. Have I overlooked them?

Thanks!
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 7th Nov 2002 22:08
if you mean moving the camera side-to-side (like pan and scan) then try this:
1) left movement: turn camera left 90 degrees, move distance required, turn camera right 90 degrees
2) right movement: turn camera right 90 degrees, move distance required, turn camera left 90 degrees

cheers.

-= i only do what my rice krispies tell me to do =-
anoon
21
Years of Service
User Offline
Joined: 30th Oct 2002
Location: United States
Posted: 7th Nov 2002 23:21
Yes ChipOne, that's what I was talking about, thanks for the tip. I will give it a try tonight.

What I had tried doing was:



I'm not exactly sure as to why this didn't work. It seems to somewhat work, but then doesn't. I'm brand new to DarkBasic (first try today!) and I'm new to progamming in general, so I'll take any tips!

Am I mental or shouldn't there be a Pan or Jog camera function!?!

ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 8th Nov 2002 00:05
what you have there would work fine, were you only ever to move along a single axis. the problem comes about when you turn the camera sideways using the mousemove functions you've hooked up.

keep in mind that if you're facing the z-positive direction, the code you've posted will work fine. do this excercise on a piece of grid paper:
1) draw a dot in the middle
2) draw a cross through the dot top to bottom and left to right
3) on the left-right axis, label it 'X'
4) the top-bottom gets 'Z'
5) draw an arrow from the dot towards the top of the page

okay, what you're looking at is a top-down view of where your camera is (the dot) and the direction it is pointing in (the arrow).

now try this:
1) 'move' your dot 2 spaces to the left along the x axis
2) redraw the arrow

if you consider this last experiment, the camera did indeed move to the left, and you saw what you expected. now try this:
1) 'turn' the dot 90 degrees to the left and redraw the arrow to point to the left side of the page
2) 'move' your dot 2 spaces to the left along the x axis
3) redraw the arrow

what happened? well...you did indeed move the camera to the left, but as far as the camera was concerned, you actually moved it 'forward'.

when you try to move the camera, you have to take into account the angle that it is facing. you can do this simply with the COS and SIN commands in conjunction with the angle of the camera, but the trick that I posted above works just the same (and lets DBPro do the SIN and COS maths for you). this was a trick that indi pointed out to me, I believe

one last excercise:
1) position the dot anywhere you like
2) draw the arrow in any direction you like
3) now move left:
3.1) rotate the arrow 90 degrees to the left
3.2) move the dot 2 units
3.3) rotate the arrow 90 degrees to the right

now, that's what we're looking for

-= i only do what my rice krispies tell me to do =-
ChipOne
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 8th Nov 2002 00:07
you could, of course, use:
CONTROL CAMERA USING ARROWKEYS

but it's really only good for temp'ing up something while testing. it's a little limiting and you can't configure too much with how it behaves.

-= i only do what my rice krispies tell me to do =-
anoon
21
Years of Service
User Offline
Joined: 30th Oct 2002
Location: United States
Posted: 8th Nov 2002 03:19
I'll try the arrow keys thing. Thanks.

Are there genral node transforms that are accessible for every object in a scene? Can I move an object on one of its local axis'?

Login to post a reply

Server time is: 2024-03-28 14:45:22
Your offset time is: 2024-03-28 14:45:22