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 / Getting object around position

Author
Message
Bjorn
14
Years of Service
User Offline
Joined: 20th Mar 2010
Location:
Posted: 3rd Jun 2010 19:45 Edited at: 3rd Jun 2010 19:45
How do I get an object in an radius around, or at an location?

Doesn't work
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 4th Jun 2010 03:32
What about trying the dbSetObjectRadius() function and then checking for collisions?

JTK
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 4th Jun 2010 11:26 Edited at: 4th Jun 2010 11:27
Not really sure what you try to do, but dbPickObject uses 2d screen coordinates, and you are feeding it with 3d coordinates, dbObjectPositionX/Y.

When least it should say something like



or just



Anyway, use 2d screen coords, or this is not the function you are looking for.
Also beware of the [0, 10000] range, the higher the range, the slower the function.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 4th Jun 2010 11:34 Edited at: 4th Jun 2010 11:42
Quote: "Also beware of the [0, 10000] range, the higher the range, the slower the function."


Are you sure? Objects are stored in a vector/array, and logically, the function looks like this


The array size does not change with higher/lower, and thus number of loops does not change.
if what you are saying is true, then this should be an error in GDK structure



Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 4th Jun 2010 12:00
Quote: "Are you sure?"

Hey I hear that too much lately
Don't worry, no offense

In the documentation of dbPickObject:

Quote: "The objects that are tested against the 2D coordinate are only those within the Object Start and Object End range in order to speed up specific tests."

And so, those parameters are there exactly to speed up the function.
Hey but you can always give it a try by yourself, I already did, but it was along time ago

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 4th Jun 2010 15:46
i can't, i dont have GDK installed, but im pretty sure the IDs have nothing to do with it's speed, the array size never change, and the loop -SHOULD- be over the array, and not the range

Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 4th Jun 2010 16:26
What I try to say is that you'll see things speed down as far as the objects in the range exist. It is wise to limit the object range as far as possible, to avoid unnecesary calls to the mesh interception.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 4th Jun 2010 21:46
well yes that's true, for large meshes intersection can be really slow

haliop
User Banned
Posted: 5th Jun 2010 02:58
Quote: "well yes that's true, for large meshes intersection can be really slow"


not if you use a good LOD technic.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 5th Jun 2010 07:57
Quote: "not if you use a good LOD technic. "

Quote: "well yes that's true, for large meshes intersection can be really slow"

with LOD you can't call it large

Login to post a reply

Server time is: 2024-07-04 11:21:27
Your offset time is: 2024-07-04 11:21:27