152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
# File 'lib/mittsu/core/object_3d.rb', line 152
def add(*arguments)
if arguments.length > 1
arguments.each do |arg|
self.add(arg)
end
return self
end
object = arguments.first
if object == self
puts("ERROR: Mittsu::Object3D#add: object can't be added as a child of itself.", object.inspect)
return self
end
if object.is_a? Object3D
object.parent.remove(object) unless object.parent.nil?
object.parent = self
object.dispatch_event type: :added
@children << object
else
puts('ERROR: Mittsu::Object3D#add: object not an instance of Object3D.', object.inspect)
end
self
end
|