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.

Code Snippets / [DBP] Free object finder with range

Author
Message
Aralox
18
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 27th Aug 2007 14:36
This is my version of the popular 'free object' snippet. i did a quick search for 'free object' which turned up with nothing, so i thought - why not just put one up? theres probably alot out there with other names, but who cares?
In case you didnt know, this snippet goes through a range of numbers (specified by you) and finds the next free (unused) object available.
It is easily modified for sounds or images, ect.



enjoy!

Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Aug 2007 18:21
The problem with that is that it will only work for things where you know you have a range of objects to choose from, rather than needing any object.

Most people do something like this:

which is all fair enough, but the problem with that is you can't do stuff like this:

because 'cube' and 'sphere' will be the same, as an object wasnt created after 'cube' was got.


This is my method:


Which makes my last example possible

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Aralox
18
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 28th Aug 2007 00:52
genious!

Login to post a reply

Server time is: 2025-08-09 01:37:37
Your offset time is: 2025-08-09 01:37:37