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 / dbPickObject for distant objects

Author
Message
Jason Held
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location:
Posted: 23rd Oct 2008 12:25
Hey,

Does anyone know how I can use dbPickObject to pick a single object from a range *near* the cursor? For example, observing a very distant object, using dbPickObject, the player has to have the cursor exactly on the small object.

I guess I could have a loop of dbPickObject commands near the cursor position, but that sounds a bit costly....

Idears?
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 23rd Oct 2008 19:14
create a large bounding box around it?
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 23rd Oct 2008 22:45 Edited at: 23rd Oct 2008 22:45
You could get dbObjectScreenX( ) and dbObjectScreenY( ) to get the objects coordinates in 2D and check if the mouse is within a certain range.

<<---------CLICK IT
Jason Held
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location:
Posted: 25th Oct 2008 11:02
Thank you AndrewT, that worked nicely. Jezza, I don't know how to do bounding boxes but will probably make a crack at it when I get a chance. There are some drawbacks to just getting dbOjectScreenX() and checking for distance....mainly that you don't get the rest ofthe info vectors you normally would with dbPick stuff, also you're forced to a distance from the center (rather than picking the actual object).

Nevertheless, it worked for what I'm doing, so cheers.

For the curious, or for anyone *newer* than myself, here's the code used:


-Jason

Login to post a reply

Server time is: 2024-09-30 09:35:38
Your offset time is: 2024-09-30 09:35:38