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.

DarkBASIC Professional Discussion / Mouse Look troubles

Author
Message
TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 05:40
I'm trying to make a camera look system for my game, for both the first and third person ... and don't know where to start. I tried the tutorial on the create... pages but they didn't work. For some odd reason, the camera kept centering whenever I tried to move left or right (with arrow keys and with mouse control) Thanks in advance.
TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 05:41
Also, if anyone knows how to prevent the camera change from happening so quickly besides SLEEP, I'd love to know, it's annoying trying to tap the space bar so quickly that the camera just happens to stop on the one you want Thanks again

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Feb 2003 05:44
you noticed you don't have a camera rotate in there?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 07:22
Yes, I just wanted a starting point if anyone had any suggestions When I did have the camera rotate, it wouldn't rotate, it would just keep jerking the camera back to the center ... weird?

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Feb 2003 07:40
not really because your also not storing the old camera angles lol

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 07:59
I told you, I used the example out of the DBPro's help file, lol. It is not present in the code above, I repeat, no part of that tutorial is present in the code above, I will repost code with it later, if it doesn't work when I recode it. I figured my configuration to switch between cameras would mess up the idea of mouse look seeing as how I want the camera to do different things in different modes, so I pulled the code and am now working on trying to weave it correctly into my functions. Thanks though RavVeg, I've been known to have brain farts like that sometimes

TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 08:13
Ok, here is what I had before, please someone help the blind man
set display mode 800,600,16
hide mouse

sync on
sync rate 40

load image "ltgraybark2.jpg",1

playerx#=0
playery#=5
playerz#=-10

load object "trunk.x",1
make object sphere 10,5

position object 10, playerx#,playery#,playerz#

texture object 1,1

xPos#=0
yPos#=5
zPos#=-10
xAng#=0
yAng#=0
zAng#=0
playerXang#=0
playerYang#=0
playerZang#=0

Rem Camera Mode - First Person
CameraMode=0

Rem ****************Camera Loop************

do

if CameraMode=0 then CameraMode=CameraFirst(CameraMode) else CameraMode=CameraThird(CameraMode)

loop

function CameraFirst(CameraMode)
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

if upkey()=1 then Move camera .5
if upkey()=1 then Move object 10,.5
if downkey()=1 then Move camera -.5
if downkey()=1 then Move object 10,-.5
if rightkey()=1 then move object right 10, .5
if leftkey()=1 then move object left 10, .5

if spacekey()=1
CameraMode=1
SLEEP 200
endif

PlayerX# = Object Position X(10)
PlayerY# = Object Position Y(10)
PlayerZ# = Object Position Z(10)

Set Camera To Object Orientation 10

Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)

position camera PlayerX#, PlayerY#, PlayerZ#
sync
endfunction CameraMode

function CameraThird(CameraMode)
playerthirdY# = Object angle Y(10)
If Upkey()=1 then Move object 10,1
If Downkey()=1 then Move object 10,-1
If Leftkey()=1 then Yrotate object 10,Wrapvalue(playerthirdY#-3)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(playerthirdY#+3)
If Spacekey()=1
CameraMode=0
SLEEP 200
endif

X# = Object position x(10)
Z# = Object position z(10)

cZ# = Newzvalue(Z#,playerthirdY#+180,15)
cX# = Newxvalue(X#,playerthirdY#+180,15)

Position Camera cX#,25,cZ#

Point camera X#,12,Z#

sync
endfunction CameraMode[\code]

TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 08:13
hmmm ... error on page when i tried to press code button ...

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Feb 2003 09:26
Tip for using the code button. Type something in, highlight it, then hit the button. Then you can just paste your code into the centre of the tags.

The same goes for all the other buttons.
Tywald
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sweden
Posted: 7th Feb 2003 09:46
TogaMario:

You have forgot to rotate your object and it therefore always looking in the same direction and since the camera is configured to look in the direction the object is looking at it won´t rotate since the object doesn´t rotate. Try to use your camera rotation angles to rotate your object.

- Tywald
TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 21:09
Wowsers, much thanks, i'll see if that does the trick! By-the-by, what does Set Camera to Object Orientation do really, I just used it to reset my camera's orientation from looking downward after exiting third person mode, i'm sure there must be an more sound way to do it, i'm just scared that used that command may screw me over later in development. Thanks!

TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 22:45
::SIGH:: the code button still isn't working, so i'll try this again (no pictures are working for me, nor any of the buttons, so bare with me)


TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 22:46
Oh yeah, the problem, i'm moving both the camera and the object, and it's still bringing me back to front and center ... ::argh:: i know it's my own stupidity, so that makes it worse, thanks all.

Kangaroo2
23
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 7th Feb 2003 22:55
No, all the buttons bring up javascript errors in all my browsers. However when I click no to debug they still work I would say this is a browser problem, but no other websites I use do this... Appart from badly programmed Pop-ups on Warez/Porn/Casino style crud rings

Coming Soon! Kangaroo2 Studio... wait and quiver with anticipation! lol
[email protected] - http://www.kangaroo2.com - If the apocalypse comes, email me
TogaMario
23
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 7th Feb 2003 23:44
Oh, don't I feel like a poop. I just had to switch the Rotate Camera and Rotate Object commands ... geez, what a pain. But I still need to know how to unpoint my camera ... or reposition it to look straight forward. My camera is still repositioned to aim down (from the command and in my third-person mode) Any suggestions?

Login to post a reply

Server time is: 2026-07-26 08:17:40
Your offset time is: 2026-07-26 08:17:40