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 / Code oddity driving me mad...

Author
Message
Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 17th Feb 2003 09:26
I spent all night working on htis code and I still can't seem to get the camera to "Walk" on top of the 2nd matrix... can anybody help???
Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 17th Feb 2003 09:28
As for the crap i don't need comment... that was waylong ago when i was trimmign the code down... just ignore it....

Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 18th Feb 2003 00:37
Can't anybody help me???

SasukiShinozawa
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location:
Posted: 18th Feb 2003 00:47
Notice that your code says this:

if camera position x() > 1000
h#=get ground height(1,x#,z#)
position camera x#,h#+playerheight,z#
else
sech#=get ground height(2,x#,z#)
position camera x#,sech#+playerheight,z#
endif


When your camera position x() > 1000, you're on top of matrix 2. Yet in the get ground height command in that section, you're checking the height of matrix 1 at your x# and z# coordinates.

Since those points don't exist on matrix 1, you're going to stay at height zero.

Same thing applies to the part after the else: You're checking the height of matrix 2 at coordinates that don't exist on it. Switch your code to this:...

if camera position x() > 1000
h#=get ground height(2,x#,z#)
position camera x#,h#+playerheight,z#
else
sech#=get ground height(1,x#,z#)
position camera x#,sech#+playerheight,z#
endif

...and it should work. Lemme know if it helps.

Tanto? Iie. Kore wa tachi desu.
Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 19th Feb 2003 05:46
Nope... I'm not sure what's going on... I'll try using other grids than x...

Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 19th Feb 2003 05:56
Nothing nada... Itried for another full hour but it still don't work...

Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 19th Feb 2003 07:14
Looks like time for a full rewrite...

Morales
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: - Please Select -
Posted: 19th Feb 2003 08:09
sync on : sync rate 70
hide mouse
make matrix 1,1000,1000,10,10
position camera 50,0,50
do
dx#=dx#+mousemovey()
dy#=dy#+mousemovex()
rotate camera dx#,dy#,0
x#=camera position x()
z#=camera position z()
if upkey()
x#=newxvalue(x#,dy#,3)
z#=newzvalue(z#,dy#,3)
endif
gy#=get ground height(1,x#,z#)
position camera x#,gy#+70,z#
sync
loop
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 19th Feb 2003 22:47
Please , bear in mind that get ground height refers to the relevant matrix coordinates, and not to real world coordinates (where you are)
so , if you matrix is offsetted from 0,0 real coords you must subtract the offset value..
for instance, if you offset your second matrix at 1000(x), 1000(z)-real world coords - and you want to get the ground height when you are walking at 1100(x) 1100(z) you must use :
get ground height (2,x#-1100,z#-1100)
i hope it will help
cheers
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 19th Feb 2003 22:52
Correction:
Sorry..that above is meant to be:
get ground height (newmatrix,x#-offset,z#-offset) therefore
get ground height (2,x#-1000,z#-1000)
cheers..
Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 20th Feb 2003 00:57
Thanks... That works!!!

Login to post a reply

Server time is: 2024-11-24 03:34:16
Your offset time is: 2024-11-24 03:34:16