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 / DBC: get ground height problems

Author
Message
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 27th Aug 2006 17:09
basically i used to use DBC a couple of years ago but i haven't done anything vaguely related to programming in god knows how long and i was never exactly great at it so i'm trying to start from scratch. i'm making a simple program to get used to using the language again but the get ground height command doesn't seem to be working... my little spherey bloke keeps sinking into the ground, and it's movement is quite erratic as it jumps between the different heights instead of sliding smoothly from one to another.

this is my code:





the problem is probably in this bit:




the only external media I am using is one picture with 2 128x128 squares on the left and one 256x256 texture included with darkbasic on the right.


can someone help me? it's probably something stupid but I don't know what I've done...

RIP Dimebag
http://db1games.topcities.com
(used to be demonsbreath)

Attachments

Login to view attachments
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 27th Aug 2006 18:26
Nope, actually it's not in that bit. When using GET GROUND HEIGHT it automatically thinks that the matrix is positioned at 0,0,0. However, the matrix is positioned at -75,0,-75 via your POSITION MATRIX command. To solve this, change this:

objya#=get ground height(1,objx#,objz#)

into this

objya#=get ground height(1,objx#+Matrix Position x(1),objz#+Matrix Position z(1))

That ought to work. Or you can just put the matrix at 0,0,0.

demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 27th Aug 2006 18:43 Edited at: 27th Aug 2006 18:55
thanks muchly man... i'll try that now...


EDIT: ok that code didn't work because i had the matrix placed at negative x and z values, so i probably should have just used minus instead of plus in your code snippet, but i only just thought of that, instead i just added 75 because the matrix was at -75,0,-75


thanks for your help

RIP Dimebag
http://db1games.topcities.com
(used to be demonsbreath)
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 27th Aug 2006 23:39
Eh, that's fine. Long as it works

Login to post a reply

Server time is: 2024-09-25 07:33:57
Your offset time is: 2024-09-25 07:33:57