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 / Accessing Object Vertex Data?

Author
Message
Laocoon
17
Years of Service
User Offline
Joined: 29th Dec 2008
Location:
Posted: 29th Dec 2008 07:38
Is it possible to access the x,y, and z coordinates of a chosen vertex of an object? Assigning a memblock the same data as an object appears to be the right track, but how do I know what number to assign the second argument in 'MEMBLOCK FLOAT (N1,N2)' to get all three coordinates? Should FLOAT instead be BYTE? Do I have to use an array somehow?

I'm attempting to write my own collision detection.

And how do you get Sparky's DLL to work with non-pro Dark Basic in case that can tempt me away from writing my own collision detection?
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 29th Dec 2008 14:15
Quote: "Is it possible to access the x,y, and z coordinates of a chosen vertex of an object?"

Yes.

Quote: "Assigning a memblock the same data as an object appears to be the right track, but how do I know what number to assign the second argument in 'MEMBLOCK FLOAT (N1,N2)' to get all three coordinates?"

A float is 4 bytes. Each single position in a memblock is 1 byte. If you need a float, then each float will have a length of 4 bytes. So in terms of X Y and Z, if the initial position of the vertex data is at byte 32, then
x#=memblock float(<memblock number>,32+0)
y#=memblock float(<memblock number>,32+4)
z#=memblock float(<memblock number>,32+8)


So every start position of the next set of vertices advances by 12 bytes:

position = 32 + (12*vertnumber)+ x, y, or z offset of 0,4, or 8 bytes

Quote: "And how do you get Sparky's DLL to work with non-pro Dark Basic in case that can tempt me away from writing my own collision detection? "


There's a link to the DBC version in this thread:

Ground Collision

Enjoy your day.
Laocoon
17
Years of Service
User Offline
Joined: 29th Dec 2008
Location:
Posted: 30th Dec 2008 04:21
Thank you. And that link is helpful also.

Login to post a reply

Server time is: 2026-07-06 00:45:46
Your offset time is: 2026-07-06 00:45:46