-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error "Cannot read property 'isEmpty' of undefined" when cloning a Geometry with a Box3Helper #19900
Comments
So the root cause of the issue is the missing The problem is that these classes derive the Helpers often have a reference to other objects in the scene and graphically represent respective properties. So I'm convinced that it's wrong if helpers clone these "parent" objects. I also think it makes no sense to just assign the object like so: this.box = source.box; It's probably best for now if the engine would avoid calling |
@Mugen87 I understand the reasons you expose, but then what should it be done when you clone a 3D object that contains a helper?? traverse the object to remove the helper, then clone and recreate the helper again? |
I'm sorry, I don't have a proper solution for this at hand. At first glance, it seems to me that performing no clone is better than performing a buggy one. A better solution would be to find a common way how helpers are attached to objects. The engine could then detect objects that have a helper and properly process them during a clone. |
It could be a by design decision not to implement a clone method for Box3Helper if performance is affected (despite we are only guessing because I understand there are no performance tests that can probe it yet). if ( !box || box.isEmpty() ) return; |
The thing is that Let's see if it's possible to find a common policy for attaching helpers in |
I totally trust on your criteria @Mugen87. |
Description
I have found an issue that seems to be a bug, when cloning a geometry that has as children a Box3Helper.
This simple scene is producing an error message:
Repro steps
The issue is easy to reproduce:
Box3Helper
Box3Helper
as its childrenI have tried many combinations including adding both to a Group to be siblings instead of parent/children, but it happens the same. I have tried to debug it my myself and the issue seems to be at this checkpoint
Box3Helper
, as the cloned instance hasbox
as undefined.Demo
Here is the repro of the issue: ( you only have to uncomment line 62:
//scene.add(dupe);
)Code
Here is the full js code:
Possible solution
Adding a
copy
method toBox3Helper.prototype
will solve this issue as box will be set cloning the source oneThree.js version
Browser
OS
The text was updated successfully, but these errors were encountered: