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 / 3d object terrain problem

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Nov 2007 08:23
Hey guys!

I have loaded an x-file terrain into darkbasic and cant figur out, how i get the ground height. With a matrix, you just say "return value=get ground height(x,y,matrix number)", but with a 3d object or x-file i loaded I cant do that. is there a way?

thecomet

Oooooops!!! I accidentally formated drive c.
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 27th Nov 2007 15:45
search the forum, this question has been awnserd countless of times

Don't look at my sig!
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Dec 2007 21:37
I have searched the forum, but the answer isn`t "intersect object" or something.

I found, you need to download this dll for 100$ to create your own function. Lets say I dont have 100$. Is there another solution?

Oooooops!!! I accidentally formated drive c.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 27th Dec 2007 21:45
Sparky's collision DLL is what you should have found and it is free.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Dec 2007 22:30
It is for free, but I can`t load any dll`s mate. You see, DarkBasic is asking me for a valid CD, and I dont know what it`s talking about. All I know is, I need that CD to load dll`s. Does anyone know what that is?

Oooooops!!! I accidentally formated drive c.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 16:08
And intersect works - just not the fastest... sparky's is faster but I agree you'll have to do some hunting but I do have a DarkGDK snip - that shouldn't be all that hard to translate:



Now in Less C++'ish pseudo code:


X and Z are where you are checking ground height. The test works by starting 10000 units straight up from this x,z position, and shoots a ray down x,z (but -10000) and you'll get the Y returned to you where the Ground is.

Now if you're dealing with walking over a ton of objects - you would need to test each object's height and go for the heightest value returned for that object ... Here I'd switch to sparky's, as you can have groups of objects and do one test versus multiple.

Good Luck

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Dec 2007 16:17
I`ll try my best, but I can`t find any "intersect object" command in the documentation. I thought that was a DBP command.

Oooooops!!! I accidentally formated drive c.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 17:32
If so I didn't mean to steer you wrong. The same technique could be used with Sparky's DLL, and its not as hard as it looks (when you first look at it).

The same technique - (providing you can get the demos running DarkBasic Classic - I presume you can...but - as I demonstrated - I can err - I'm human) can be used with Spark'y Ray Cast Function. The steps would be:

1: SetUpObject (couple ways - for ground, might need sc_setupcomplexobject) but basically you just give object id, and it does some behind the scenes stuff to learn about the object in question.

2: Raycast just like that intersect command - but make sure parameters are correct - as sparky has stuff for group collisions and stuff. Also the parameter order of intersect by no means will be the same - lucky if it is

Good Luck

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 8th Jan 2008 11:51
object collision() will return if the objects are overlapping, if that helps...

"A West Texas girl, just like me"
-Bush
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Jan 2008 10:28
@demons breath
if I use object collision() I will be hovering at the top of the landscape, not affected by the hills. Meaning, I will always stay at the same height, no matter how many hills there are.

Oooooops!!! I accidentally formated drive c.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th Jan 2008 11:05
@Comet
Check out this link. Roddman put together a pretty good example of using collision to maintain the camera height on a terrain. To be able to see what is going on, you might have to set the object to wire frame:

SET OBJECT <obj>,0,1,1

http://forum.thegamecreators.com/?m=forum_view&t=112058&b=10

Enjoy your day.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Jan 2008 11:45
I can`t find the link to download the map for that example...

Oooooops!!! I accidentally formated drive c.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th Jan 2008 16:03
Can't you see the red download button at the bottom of his post?

TDK_Man

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jan 2008 12:14
Ah, yes I can now. It`s not that obvious

Oooooops!!! I accidentally formated drive c.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th Jan 2008 12:37
True - but now you know they might be there - I didn't know the edit button existed for a while!

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jan 2008 14:11 Edited at: 12th Jan 2008 14:12
What edit button?!




Oooooops!!! I accidentally formated drive c.

Login to post a reply

Server time is: 2025-06-02 10:07:05
Your offset time is: 2025-06-02 10:07:05