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.

Dark GDK / Height between two points

Author
Message
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 2nd Sep 2005 11:26
I'm trying to get the height between two points of an object. Unfortunately dbIntersectObject can only deal with one object at a time, so I thought that we could find out which object is currently being detected. That too doesn't work terribly well either.

What I want to do is calculate the height between two points of an object and adjust the height accordingly (so when the box objects are titled, the box stays at the correct height.

Normally I would use a matrix, but unfortunately that cant be tilted...



Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 2nd Sep 2005 14:57 Edited at: 2nd Sep 2005 14:58
two points of an object? you mean verts or *any* point of an object? if verts then just use the vertex commands to get the y. assuming a & b are the Y of the two verts then this will easilly give differance between them:

h = a > b ? a - b : b - a;

if you mean any point at all in an object that isnt nessiarilly a vert point then thats a little out of my league. Although if you know what the points ARE then surely you know the Y of each co-ordinate and can perform the above calculation?

I'm probably misinterpretating your needs

OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 2nd Sep 2005 15:15 Edited at: 2nd Sep 2005 15:18
Essentially its the height of any vertex of any object - whilst intersect object works fine, it will only work with a known object, which is not always availiable (and thus I would like to get the height any any given X & Z coordinates which could be over any object).

I would like something like get ground height, except for objects - the idea being to detect raised blocks etc etc

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 2nd Sep 2005 16:10
Ah, now that IS an issue. For my rpg dungeons (which are split into tiles) i was lucky because it was a 2d tile map format array and alongside the tile id i stored the object id so i just performed an intersect object against the id in the array at px / ts, py / ts.

However outside dungeons i cant see my array thing working well at all, unless i never have a level with an over hang or something. If you manage to get a generic GetGroundHeight() function that works against objects instead of a matrix then please share, that would be awesome XD I'll have a think on it too and let you know if i come up with any further ideas

OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 2nd Sep 2005 16:32
The only think I can think of is to store the ID numbers in an array or do multiple scans downwards (which would be rather stupid).

Now, if NG was up and running with DarkSDK, it may be easier

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Sep 2005 12:09
It should be really easy to get NGC C++ working with Dark SDK. I do not have Dark SDK yet but looking over the commands, I don't see a reason why it couldn't work. Unless I am overlooking something. As far as a homemade get ground height command, Phaelax posted a DBP replacement version that works with objects instead of matrixs. You should be able to modify it for use. Hopefully I will have Dark SDK at the first of the year.

OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 3rd Sep 2005 16:33
Do you know whereabouts it is ? Codebase or code snippets ?

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 3rd Sep 2005 22:35
I think the terrain library posted by Phaelax is in the code base. It will have to be modified slightly for non terrain setup objects. Here is the function though you may need the whole library to look at how it is setup.



OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th Sep 2005 01:34
Thanks

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Artus
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: France
Posted: 5th Sep 2005 19:27
Quote: "The only think I can think of is to store the ID numbers in an array or do multiple scans downwards (which would be rather stupid)."

I neither see how it could be else. However, some optimizations are surely possible. You may for example first check for each object that its horizontal boundaries (XZ) contain the XZ point to test before performing a vertical intersectObject on it.... although it may not be so evident to find the said boundaries if the object is rotated and of a weird shape ; it may be safe to take a circle around the object with a radius of the largest of Xsize and Ysize of the object multiplied by sqrt(2).
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Sep 2005 05:48
Actually, you can thank Kevil (or was it Kenmo?) for that snippet. He wrote it for me to replace the current method I was using.

Your signature has been erased by a mod because it's larger than 600x120...
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 6th Sep 2005 05:55
Quote: "He wrote it for me to replace the current method I was using."

Okay

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk

Login to post a reply

Server time is: 2024-04-19 07:39:11
Your offset time is: 2024-04-19 07:39:11