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 Discussion / using same object multiple times

Author
Message
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 24th Mar 2003 08:22
okay i posted before about this but wasnt clear on it below is segment of code where i have loaded the same objects to place the in different positions that i want how can i just load it once and keep producing more to place at different positions.am i suppose to make meshes


D Man
22
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Germany
Posted: 24th Mar 2003 08:40
You could clone the object(clone object).
You would load the object once and clone it.

"If you can't make it good
make it look good."
Bill Gates
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 24th Mar 2003 10:12
what is the exacy syntax for cloning a object
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 24th Mar 2003 18:04
you can load the mesh (using the load mesh command)
and then make object (using the make object command )
you can make as many objects from your mesh you want
Dr DooMer
22
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 25th Mar 2003 01:33
There's problems with that approach though - using the mesh commands as a means of cloning your objects will result in a loss of all limb and animation data.

I'm currently working on a way around this, but with the lack of a "make mesh from limb" command, it's becoming very difficult...

"I am a living, thinking entity who was created in the sea of information."
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 25th Mar 2003 02:16
the objects dont have any animation data or limbs there rocks and plants
Dr DooMer
22
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 25th Mar 2003 04:16
That's okay then.



This snippet will create 100 copies of the "plant.x" model, each textured with the "leaves.bmp" texture. However, it only loads the plant model and texture once, meaning that it's much faster than 100 seperate "load object" commands.

"I am a living, thinking entity who was created in the sea of information."
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 25th Mar 2003 07:22
okay makes sense but what if i want to position them at specific coordinates:

load mesh "alien plant.x",56
load image "moss05.bmp",4
for i = 1 to 7 (i want seven of these made)
make object i,56,4 (is this going to make seven of them them being objects 56-62)
next i
i also want them at specific positions
below is the mess i orginally had and want to shorten it not loading over an over
kfoong
22
Years of Service
User Offline
Joined: 28th Jan 2003
Location: Australia
Posted: 25th Mar 2003 13:42
how about using static objects?

--------
http://www.stellarblue.vze.com/
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 26th Mar 2003 00:34
i heard about that method how would i go about that and is it easier than making a loop
Dr DooMer
22
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 26th Mar 2003 01:08
You'll still have to position the objects manually by means of a seperate position object command for each. As for the scaling command, that can go into for-next loop, cutting out three of the four lines for each object you make.

Static objects are created in, what some might say, an unusual manner. Instead of loading something in as a static object and then positioning it in the world, you actually load a normal object and then copy it into the static world. What you would do is load one object as your plant, position it and then call the make static object command. This would copy the object over into the static world, where it becomes completely non-interactive, but leaves the original object as it was before. This means that you can move your normal object to the next position and copy it over again, without needing to reload. After you've made static objects at all the positions you need them in, you can safely remove the original plant object.

I can't say which method is best because it depends on the situation. However, I would hazard a guess that you'd be better off with static objects approach.

"I am a living, thinking entity who was created in the sea of information."
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 26th Mar 2003 23:47
okay ive been experimenting with the static method of doing it but am not sure exactly on the basis of it. check this out:

(orginal data that will be deleted once not needed right,once you copy all of it to a static you dont need the source right)
load object "alien plant.3ds",1
position object 1,0,0,0
scale object 1,0,0,0
texture object 1,0

make static object 1(creates an object from the data of object 1 above)
now to make like 5 static objects of the same object them being different object numbers
do i put next position object 1(from top)in its coordinates
then do make static object 2(or next number)how will it know where to get the data from this time
Dr DooMer
22
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 27th Mar 2003 04:02 Edited at: 27th Mar 2003 04:03
It would be something like this:



You see, static objects don't have numbers. They kind of all exist within the same object. Once made into static, they become part of this object and can no longer be identified individually, but instead as a whole 'static world'. Also, the parameter that the make static object takes is the number of the source object (in this case, 1), just in case you were wondering.

Does this help?

"I am a living, thinking entity who was created in the sea of information."
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 28th Mar 2003 08:15
okay i was thinking they each had individual numbers to identify them well im going to try something then and see if i get it to work right what you said gives me a clearer understanding of the static world.

Login to post a reply

Server time is: 2025-05-18 08:11:51
Your offset time is: 2025-05-18 08:11:51