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 Discussion / First Person shooter camera problem

Author
Message
WebMonster
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location: Hungary
Posted: 7th Feb 2003 22:26
Hi!
I have a big problem, with my game's camera. I maked a level with "Magic World" and I imported it. The problem is there are mountains, and my camera "don'T climb up the moutains", else it's going throught the mountain. Wahat's the problem with it?




Do
CX#=Camera Angle X(): CY#=Camera Angle Y(): CZ#=Camera Angle Z()
CX#=Wrapvalue(CX#+mousemovey()): CY#=Wrapvalue(CY#+mousemovex())
Rotate Camera CX#,CY#,CZ#



If Upkey()=1 then MOVE camera 10



M#=Get Ground Height(100,CAMERA POSITION X(),CAMERA POSITION Z() )
set cursor 1,1
print M#
POSITION CAMERA CAMERA POSITION X(), , CAMERA POSITION Z()



If Downkey()=1
move camera -10
Position Camera Camera Position X(),Gh#+30.0+bob#,Camera Position z()


Endif

Sync

Loop


Please help me!
--==|| LAMAS RULZ! ||=--
The home of the Lama's
large_nostril
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United States
Posted: 8th Feb 2003 01:17
cy#=get ground height(MatNum,cx#,cz#)[+Num]

Where MatNum is the matrix number you are using. You might need/want to adjust this by adding an additional value [+Num] so that your camera view is not right on the ground.

If you want fresh underwear in the morning, take it off the night before.
Necrym
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: Australia
Posted: 8th Feb 2003 05:16
Try this function with Single or Multimatrix frommMagic World

```GET WORLD HEIGHT function
```This will find the current matrix y# ground height position
```based on the Number of matrix used in variable mat#
```and the Matrix x,z tile size in variables matx# and matz#
```these can be set from an array if required.


function WORLDHEIGHT(x#,y#,z#,firstmatrix,mat,matx#,matz#)

for a=firstmatrix to (firstmatrix+mat)-1
xx#=matrix position x(a)
zz#=matrix position z(a)
if x# > xx# and x# < xx#+matx#
if z# > zz# and z# < zz#+matz#
yy#=get ground height(a,x#-xx#,z#-zz#)
grnd#=yy#
endif
endif
next a
endfunction grnd#

=======================================================================

An example of how to call it is

Rem: Store old object position
oldx#=object position x(1)
oldz#=object position z(1)
oldy#=WORLDHEIGHT(oldx#,object position y(1)+1,oldz#,1,mat,matx#,matz#)
position object 1,oldx#,oldy#+1,oldz#

Watch the bouncing cursor - now in 3d
Necrym
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: Australia
Posted: 8th Feb 2003 05:19
Damn code thingy ill try again



Watch the bouncing cursor - now in 3d
Clacker
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location:
Posted: 8th Feb 2003 12:14
I had the same problem and i fixed it with 1 simple command

Position Matrix 0,0,0

thats it.
Clacker
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location:
Posted: 8th Feb 2003 12:16
^
|
|

Of couse you need to use the Get Ground Height command aswell

Login to post a reply

Server time is: 2024-05-18 18:28:19
Your offset time is: 2024-05-18 18:28:19