-
Notifications
You must be signed in to change notification settings - Fork 116
Description
A custom override on THREE.Scene.prototype.add breaks the engine's native ability to add multiple objects in a single call. When scene.add(object1, object2) is used, only the first object is added to the scene, and the rest are ignored.
Cause
The override function's signature accepts only a single argument (function(object)), so it discards any additional arguments passed to it before calling the original scene.add method.
Proposed Fix
Update the override to use rest parameters (...objects) to capture all arguments into an array. Then, iterate over the array for any custom logic and use originalAdd.apply(this, ...objects) to pass all objects to the original method.
Or alternatively, follow three.js' object.add to call add on each argument: https://github.com/mrdoob/three.js/blob/54ac263593c81b669ca9a089491ddd9e240427d2/src/core/Object3D.js#L720