Has CopyEntity always copied the children of the entity?
Without knowing this I created a lot of duplicate entities that seemed to have the names of already freed entities.
Two days to track down this feature of the command , which is not mentioned in the manual :(
graphics3d 640,400
cam = CreateCamera()
positionentity cam,0,0,-15
type ents
field piv,cube
end type
piv=createpivot()
nameentity piv,"pivot"
cube=createcube(piv) ;parent cube to pivot
nameentity cube,"cube"
entitycolor cube,1,255,1
EntityPickMode cube,2,1
for count = 1 to 6
NewEnt.ents = new ents
NewEnt\piv=copyentity(piv) ;<< only copy pivot
nameentity NewEnt\piv,"pivot 2"
positionentity NewEnt\piv,rnd(-10,10),rnd(-10,10),0
debuglog "child "+getchild(newent\piv,1)
next
hideentity cube ;<< Free cube
freeentity cube
hideentity piv
freeentity piv
repeat
renderworld
pickedent=camerapick(cam,mousex(),mousey())
if pickedent > 0 then
text 10,10,"Point to Entity to get name."
text 10,70, "pickedent = " + pickedent + " name is "+ entityname(pickedent)
debuglog "pickedent = " + pickedent + " name is "+ entityname(pickedent)
end if
flip
until getkey()
|