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 Professional Discussion / need help with selecting objects

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 21st Sep 2011 21:44
here is my function for selecting objects


now, what i want is to be able to left click any object on the screen and it gets bounding box around it and returns its id, this function doesn't work properly i have put this in main do loop. i need this to work with my editor but the problem is that pick object needs exact number of objects to work how can i get this working?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Sep 2011 23:45
PICK OBJECT...This command will return the Object Number of the closest object at the specified screen coordinates.


So according to that it doesn't need to know the exact number of objects, it will tell you which object you picked. So you can throw out the huge loop.

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 22nd Sep 2011 14:52
Return Integer=PICK OBJECT(Screen X, Screen Y, Object Start, Object End)

Return Integer=PICK OBJECT(Screen X, Screen Y, Object Start, Object End, Ignore Camera Flag)

so it needs exact number of objects to work, so what now?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 22nd Sep 2011 15:08
Not number, it needs number range. 1 to 600 or whatever. Any object lower than 600 will work. Just keep your objects in the same range.

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 22nd Sep 2011 17:51
i based my code on this one that i found here on forum


try changing PickRangeEnd variable to anything and the code will not work, what i originally wanted is to make the function that will handle object selecting no matter if there are created or deleted objects and return object number of selected object
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 22nd Sep 2011 18:36
Quote: "try changing PickRangeEnd variable to anything and the code will not work, what i originally wanted is to make the function that will handle object selecting no matter if there are created or deleted objects and return object number of selected object "


PickRangeEnd is k

make object sphere k , 3

So the source code only makes objects that work inside the end range. All you have to do is make sure that your objects do not go higher than k.. or higher than anything you chose so long as you don't go over that number.

Decide how many objects you want, and make those objects, then set k to the last number.

Login to post a reply

Server time is: 2026-07-10 13:45:26
Your offset time is: 2026-07-10 13:45:26