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 / My character falls through my matrix!!!!!!!!!

Author
Message
gopherbro 94
16
Years of Service
User Offline
Joined: 21st Dec 2008
Location:
Posted: 24th Dec 2008 04:59
Im having a problem with my character falling through my matrix! When the game starts he just falls through the floor! People have told me to use the get ground height command but I dont know how. I have used this but it still doesnt work. HELP!!!!!

MAKE MATRIX 6,2000.0,2000.0,30,30
position matrix 6,-1005,2,-1005
rem Texture landscape
PREPARE MATRIX TEXTURE 6,99,1,1
rem Randomize landscape
RANDOMIZE MATRIX 6,35.0

REM OBJECT CREATION

Rem Player Character
make object cylinder 1,50
scale object 1,100,140,100
texture object 1,1
y#=get ground height(6,x#,z#)
position object 1,x#,y#,z#
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 24th Dec 2008 05:33
You should have posted this in the original thread not make a new one
Posting will bump your thread to the top of the page and people would be able to see what advice has already been given etc.
PS don't just bump threads though, double posting (posting twice in a row without anyone else posting in between) is banned.

This looks like you're setting up your game, you'll need to use the GET GROUND HEIGHT inside your game loop to keep it up to date. could you post the whole code please.
PS why do you use matrix 6? do you have 6 different matrices in your program?


Goke of the day: [Q]What's a coders' favourite part of an orchestra?
[A]The strings.
gopherbro 94
16
Years of Service
User Offline
Joined: 21st Dec 2008
Location:
Posted: 24th Dec 2008 06:03
sorry oBese87 I did not realize I could edit the previous forum posts. I will do that from now on.
But to answer your question i use matrix 6 because i have other bitmaps and objects the are 1 so it is easier for me to remember that my matrix is #6. ( i only have 1 matrix )

Do you want me to post the code for the entire game? ( If i show everything can you tell me how to use the get ground height command? I do not really understand it.
P.S. I made a simple floor so I could make sure the other details work . If i get rid of the floor my character falls through! THANKS!!!!!!

FOR some reason it wont let me enter in the entire code. I copy and paste it, then highlight and click CODE. but it says i have bad language. SORRY
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Dec 2008 10:19
Got it.

It IS using get ground height correctly. However, it looks like it is positioning the cylinder at its center, rather than its end. To fix, just add half of its height like so:

y#=get ground height(1,x#,z#)+(object size y(1)/2)

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
gopherbro 94
16
Years of Service
User Offline
Joined: 21st Dec 2008
Location:
Posted: 24th Dec 2008 17:34
That still doesn't work for some reason. The cylinder still falls through the floor. DO you think it has anything to do with the fact that I used the POSITION MATRIX command? In a different post someone said that that would affect it because the GET GROUND HEIGHT gets its coordinates from 0,0,0. But since my matrix is at -1005,0,-1005 How should I alter the GET GROUND HEIGHT command?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Dec 2008 03:41
Quote: "DO you think it has anything to do with the fact that I used the POSITION MATRIX command?"


I do believe that getting the correct ground height has to do with the matrix position. If you reposition the matrix, you have to include the offset of where it was positioned with the position you want to test the height.

For example, if you shifted the matrix 1005 units to the left (x=-1000) and 1005 units backwards (i.e. z=-1005) then you would have to ADD 1005 to the position you want to test:

height#=get ground height(<mat num> ,x+1005, z+1005)

Enjoy your day.

Login to post a reply

Server time is: 2025-06-07 20:56:55
Your offset time is: 2025-06-07 20:56:55