-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Undefined access when anim component with multiple layers is cloned #6395
Comments
vote for clone button in every example - such a good Litmus test 😅 🙈 The lack of JSDoc makes it hard to figure out, but I got this to work anyway: const clone = pc.app.root.children[2].clone();
pc.app.root.addChild(clone);
clone.translate(0.5, 0, 0); I saw multiple issues:
Example: class Test {
_hi = 123;
get hi() {
return _hi;
}
}
test = new Test();
const obj = {...test};
console.log("obj", obj); Outputs: Happens in two places: engine/src/framework/components/anim/component.js Lines 378 to 383 in e3217c4
engine/src/framework/anim/controller/anim-controller.js Lines 131 to 134 in e3217c4
engine/src/framework/components/anim/system.js Lines 46 to 49 in e3217c4
You can hack it up like this for making it work: if (data.stateGraph) {
data.stateGraph.layers[0] = data.layers[0]; // hack
data.stateGraph.layers[1] = data.layers[1]; // hack
component.stateGraph = data.stateGraph;
component.loadStateGraph(component.stateGraph);
} And then there are even more issues, just simple type bugs basically. The component just needs more JSDoc and such issues would be automatically detectable. I tried it in the past, but it was blocked: #2986 |
I would suggest that the unit tests are designed exactly for checking this type of thing rather than the examples. |
Application crashes, when trying to clone an entity with an Anim Component that has more than 1 animation layer.
Repro:
Open engine example: https://playcanvas.github.io/#/animation/layer-masks
And add to the end:
The text was updated successfully, but these errors were encountered: