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 .NET / Is it possible to get an Object ID by checking a XYZ point in the world ?

Author
Message
Arkham Horror
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location:
Posted: 8th Jun 2011 18:28
HI !

If yes, how to ?

thx
Popper
12
Years of Service
User Offline
Joined: 7th Jun 2011
Location: England
Posted: 9th Jun 2011 15:35 Edited at: 9th Jun 2011 16:00
darkgdk.basic3d.object3d.pick(x,y,objectstart,objectend).id

~Popper
Arkham Horror
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location:
Posted: 10th Jun 2011 17:36
thx for the answer, but, nope, it's not possible ...
.pick = Returns the closest object at the mouse's current position (relative to the screen).
i want to ckeck an object in the world, not the screen ...
nvm, i figured out how to fix my problem and it's working like a charm !
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 3rd Jul 2011 16:26 Edited at: 3rd Jul 2011 16:39
Let us see your solution if possible; but to answer the original question; you will need to query the object near a given position.

The following Visual Basic example can be done in DBPRO as aswell; you just need to alter the language using the original commands. Note that the use of [dim] in Visual Basic has been used to declare variables, not arrays.

Note that the use of the [AndAlso] keyword instead of the [And] keyword tells Visual Basic to only test the result of the next expression if the previous one is true; to save a little processing time.

We have created a function called: GetObjectAt( [x], [y], [z], [defaultId] )

It will get the object at position X,Y,Z or with that location in its bounding box. It will search for the first occurance of this condition and return the first object that meets the requirement.

It will return [defaultId] if none was found.

If you need to control object priority, alter the function accordingly, searching from objects with high priority to the objects with the lowest priority. You could use the OrderBy query to sort a list:


In the above example; q will contain all of your objects in order of their priority highest to low.

OR

will sort the list from low to high


In this example; the green sphere is used to set the position, and the cubes are coloured green when overlapping that position. In your case, you would want to set the position using literal or other variable parameters.



VB Code:


Login to post a reply

Server time is: 2024-04-16 09:42:25
Your offset time is: 2024-04-16 09:42:25