copying a copyentity

Blitz3D Forums/Blitz3D Programming/copying a copyentity

JBR(Posted 2005) [#1]
Hello,

reference% = createcube()

copy1% = copyentity( reference% )
turnentity copy1%, 3, 4, 5

copy2% = copyentity( copy1% )

freeentity copy1%

i.e. i want copy2 to be the cube rotated

Is this allowed or should i copy the reference & rotate for copy2

Thanks
Marg


Picklesworth(Posted 2005) [#2]
Best way is to test it out :)
No, I doubt that Blitz would mind at all.


By the way, you don't ever need to use % to define an integer variable. Integers are the default in blitz, so if you just have nothing after the variable name it will assume that it's an integer.


JBR(Posted 2005) [#3]
Tried it out and seems to work as expected.
Worried about memory leaks though.

Marg


Stevie G(Posted 2005) [#4]
You could need to use copymesh and rotatemesh in this instance .. copy2 would be exacly the same mesh as copy1. I don't think copyentity copies rotation information ... Judging by your last post it does ?!

Why not just do ..

Mesh = createcube()
rotatemesh Mesh , 3 , 4, 5


Ross C(Posted 2005) [#5]
CopyEntity just copies the mesh, and all other attributes of that entity. If you free the entity it was copied from, the other will continue to exist. But, it's doesn't actually copy the mesh as far as i can remember. I think if you were to actually modify the mesh in some way, it might copy it...


jfk EO-11110(Posted 2005) [#6]
CopyEntity creates an instance of the reference mesh. It won't even create a true Blitz Mesh. If you alter the texture on the reference mesh, it will affect all copies too (if I remember right :) I kind of stopped working with copyentity for exactly this reason). Now if you delete the Referece entity, Blitz will notice if it has some instances and keep the reference mesh silently in memory to allow ongoing access by the instances. When you delete the copies too, the reference mesh will be deletet with the last copy.

If you create a copy of a copy, Blitz will realize that it can't do that and find the top reference mesh of the copy1 mesh. Probably this search is done recursively.
Well, that's how it seems to me.


Ross C(Posted 2005) [#7]
So jfk, what if you alter the actual mesh? Does it alter all copies?


Stevie G(Posted 2005) [#8]
It definately alters all copies. If you use any mesh commands on the original the rest will follow suit.


RGR(Posted 2005) [#9]
The main question is: Why do users have to discuss things like this in a forum with "maybe" or "afaik" or "it seems to me as if" etc. and it is not explained exactly in the manual by someone who really knows ???
Here are 4612 threads at present about Blitz3D Programming - 4500 could be saved and the thousands of hours needed to read in them could be saved as well and better used for programming - if this all would be there where it belongs - the manual !!!


Stevie G(Posted 2005) [#10]
I don't think it's a manuals job to explain the internal structure of Blitz3d but I agree it would be good to have at least an FAQ section on issues such as this so that we know exactly what's happening in b3d's bowels. Mark has probably answered most of these questions in the past right enough.


RGR(Posted 2005) [#11]
I don't think it's a manuals job to explain the internal structure of Blitz3d
Wrong ! That's the reason a "Manual" or call it "Reference" or "Programmers Handbook" is for...

And do you expect that someone who buys Blitz3D now should read all 46000 Posts with suggestions of users before he starts programming?


Stevie G(Posted 2005) [#12]
What you bleating at me for RaGR?! Everyone who's used B3d for any length of time knows that the user manual is shit ... and could be alot more detailed. This has been asked for many times but until it's udpated ( probably never now ) then we have to rely on others experiences.


jfk EO-11110(Posted 2005) [#13]
Well I say "AFAIK" or "AFAIR" to be on the save side, because I could be wrong. Sometimes I have tested something and then I write about it 2 years later and I don't remember every aspect exactly. But this really shouldn't be a reason to worry about, RaGR.


Ross C(Posted 2005) [#14]
Thanks Stevie, jfk.


RGR(Posted 2005) [#15]
;


Ross C(Posted 2005) [#16]
What the hell are you talking about now?

Stevie G and jfk explained that moving a vertex on an entity affects all the copies. For that information, i thank them for it.


GfK(Posted 2005) [#17]



RGR(Posted 2005) [#18]
Ross - I misunderstood you - it is removed - sorry for that ... am overwrought - need a break


Ross C(Posted 2005) [#19]
Ok, no worries.