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 / .3ds or .x matrix walking

Author
Message
Guitarman
21
Years of Service
User Offline
Joined: 31st Jan 2004
Location:
Posted: 28th May 2005 11:58
Ok so my question... when using .x or .3ds objects as landscapes, how do you handle things such as hills? Using a matrix, you can use the "get ground height" command, but how is it done with a .x or .3ds object? (note: I'd rather not use a DLL, but if it's an option please let me know) Thanks all!!
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 28th May 2005 13:50 Edited at: 28th May 2005 13:50
i dont think dbc has a command where you shoot a "line" and see where it intersects object, this is how you can check the y value of a mesh in dbp

perhaps you could use the built in collision command to see when hes on the mesh. make the player fall until he collides with the mesh

there has to be ways. i havent coded in about a year though
bibz1st
22
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 29th May 2005 01:52
why do you not want to use a dll?
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 29th May 2005 14:06
Guitarman,

I do not have the knowledge to speak of this at all. However, I am trying to learn the format of the text files of .x files. Once I get my hand on them, I should be a able to create functions using the vertex information stored in the text files.

I bring this to light as a method you could seek to use. I believe DLLs are great, but am one to want to figure the maths for any future use. Good luck.


+NanoBrain+
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 30th May 2005 22:02 Edited at: 30th May 2005 22:03
The solution is in the "room" demo.
The collision is build on this principe:

xpos= the old position of the object x
zpos= the old position of the object z

if you want create a matrix you need the ypos (up /down)

then you set the collision of the matrix / room to siliding

<<set object collision to siliding?>> (maybe look in the index )

and the finaly in the loop:

if object collision(matrix,the object)=1 then you must set the current position of the object to the old one.

maybe like that

xpos=old
ypos=old2
zpos=old3

xposnew=currentpos
yposnew=currentpos2
zposnew=currentpos3

if object collision(matrix,object)=1
currentpos=old
currentpos2=old2
currentpos3=old3
endif


then you will need a subrountine which checks the old position (ypos xpos zpos)

You only must watch in the room example.

I hope this is right

[href][/href]
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 31st May 2005 00:11
Nope, that's sliding collision mate.

Really, with plain old manilla DB and no access to the heightmap your kinda limited.

If you have the heightmap of the mesh, like if the mesh is just like a matrix with a set grid, then you could interpolate the heights depending on your actual position, which is the easiest way to do it when you have the luxury of the data. Perhaps getting a heightmap first the looking into interpolation (I could show you a groundheight function that uses a simple 2D array). The raw data might be able to help you, like if you can work out the scaling etc to give you the vertice heights on a grid. I think this is the fastest method you'd find to calculate ground heights besides the built-in matrix commands.

The other option is to get the advanced commands plugin, and that would allow Sparky's collision .DLL to work - this might be worth the bother as it'd give you a solid system for bullet collision, line of sight, all that complex stuff you may not have considered yet. The .dll is simply an intersection checker, but one that returns usefull data, for making decals etc, or flattening stuff to terrain.


Van-B

Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 31st May 2005 05:49
Yes Ive noticed that since 2 minutes
sorry dont work.
Lee use plains as collsion

[href][/href]
toggy
19
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Serbia
Posted: 6th Jun 2005 08:49
To Guitarman:

This example uses Sparky`s collision DLL.
You got here a x object-landscape and you can walk all over it.
Hope it`s helpes.
Any questions at: [email protected]

Attachments

Login to view attachments

Login to post a reply

Server time is: 2025-05-23 00:16:20
Your offset time is: 2025-05-23 00:16:20