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 issues

Author
Message
Veeds
16
Years of Service
User Offline
Joined: 1st Nov 2008
Location:
Posted: 4th Nov 2008 16:49
Standing on top of the ground is the issue I've been having, whenever I load the .exe to test it, I run right through my terrain.

My terrain is loaded through 3D World Studio, that works fine, but I cant seem to get my "camera" or the First person to stand on top of the ground. I will attach my code below, and any help would be deepy appriciated.. Thanks guys for putting up with us newbs!


Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 4th Nov 2008 18:35
Well the value "Y#" isn't defined anywhere, so it will just position the camera at a positive 50 units up. If you're aiming for an RPG-style terrain interaction where the player is always aligned to the terrain, then have a look into the INTERSECT OBJECT command (for a loaded map). As I understand it, it will give the distance to intersection from the first xyz point you specify. If you're aiming for typical FPS interaction, with jumping et cetera, then you'll need to use some form of collision against the terrain. You could either develop your own collision system with the INTERSECT OBJECT command, or use an existing one.

Hope this has helped, and if I've said something that isn't correct, anyone please correct me.

I am sorry for my not replying to my last thread that asked for help.. I am active now and will try to reply to help!
Veeds
16
Years of Service
User Offline
Joined: 1st Nov 2008
Location:
Posted: 5th Nov 2008 15:40
could you possibly give me an example? I'm sorry im newbish.
Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 6th Nov 2008 14:09 Edited at: 6th Nov 2008 14:12
Well, if it was an FPS style of collision then this would be a basic example:



So it basically draws a line from the player to a position directly below the player, and checks to see if that line goes through the map object. If it does, then it pushes the player up. An alternative would be (if including gravity) to move the player down by a variable (symbolizing the gravity). If the line goes through the map object, then set the gravity variable to 0. If it doesn't, then increase the gravity variable for a smooth fall:




Then if you're aiming for the RPG-style terrain interaction, then this method I saw on the forums should help (I'm sorry but I don't remember who posted the method):



I hope this makes sense.

I am sorry for my not replying to my last thread that asked for help.. I am active now and will try to reply to help!
Veeds
16
Years of Service
User Offline
Joined: 1st Nov 2008
Location:
Posted: 6th Nov 2008 15:08 Edited at: 6th Nov 2008 16:25
It makes sense, it's just now that when i try to run it i get a runtime error every time.. =( Any ideas?

I also have darkbasic professional as well if that makes any sort of differece.

Thanks for the help to.
Twu Kai
19
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 7th Nov 2008 10:51 Edited at: 7th Nov 2008 10:58
What's the runtime error? I'm using DBPro too, so that's fine.

Assuming you want the FPS-style collision and gravity, I've tried implementing it into your code (I hope you don't mind) to see if there was a problem for me. It runs fine for me, although I had to replace the map you load in for a box object.



Edit: Also, if this is the method you need and it eventually works for you, hopefully you can imagine how the INTERSECT OBJECT command can do basically the same thing on the X and Z axies for collision. Just be aware though that it's a fairly slow command, so you might need an alternative to the DBPro command in the future depending on what type of game you're making.

I am sorry for my not replying to my last thread that asked for help.. I am active now and will try to reply to help!

Login to post a reply

Server time is: 2024-11-25 16:45:28
Your offset time is: 2024-11-25 16:45:28