add method
Adds object
as child of this object. An arbitrary number of objects may
be added. Any current parent on an object passed in here will be removed,
since an object can have at most one parent.
See Group for info on manually grouping objects.
Implementation
Object3D add(Object3D? object) {
if (object == this) {
console.warning('Object3D.add: object can\'t be added as a child of itself. $object');
return this;
}
if (object != null) {
if (object.parent != null) {
object.parent!.remove(object);
}
object.parent = this;
children.add(object);
object.dispatchEvent(_addedEvent);
}
else {
console.warning('Object3D.add: object not an instance of Object3D. $object');
}
return this;
}