Game Development Community

Clone SimSet?

by Gellyware · in Torque Game Builder · 12/31/2008 (8:09 am) · 1 replies

Is it possible to clone a simSet?

(without editing source)


i.e.

$simSet1 = new SimSet();

%o = new SimObject();
%o.val = 1;

$simSet1.add( %o );


$simSet2 = new SimSet();
$simSet2 = $simSet1;

#1
12/31/2008 (8:15 am)
Within script the variables are really just references to object ids. So, $simSet2 = new SimSet(); might give $simSet2 a value of 1234, but then the $simSet2 = $simSet1 will replace that with whatever the id of $simSet1 is. In essence, $simSet2 and $simSet1 will point to the same object, but there will not be two instances of $simSet1.

That is my understanding anyway. If any of the above is wrong, I'm sure someone will let us know...

I don't believe there is a default copy or clone method of SimSets, so you would have to do the moving yourself in script or create a method in code.