Hello guys,
I’ve done the on-click animations of doors and drawers on my front end. I’ve integrated the AR also to view our customized shelf and cabinet. But in AR the animations of door are happening automatically that too not like with the same pivot and direction it was defined for actual on click animation and it’s always happening for the very first door/drawer, I’ve tried conditional logic and all for that but it’s not working. So how can I disable the animation while AR is active?
Can you guys help me resolve this?
@MajorMeerkatThe3rd @mathieu1
Hello @Ankita_Kushwaha,
you can remove the animation data from the scene before the AR-function is called and add it again to the scene afterwards. The code for it would look something like this:
// store animation data in a separate array
const nodeAnimationDataPairs: { node: ITreeNode, data: AnimationData[] }[] = [];
// traverse the scene tree and store animation data in a separate array
sceneTree.root.traverse(node => {
const animationData: AnimationData[] = node.data.filter(d => d instanceof AnimationData);
if (animationData.length > 0) {
nodeAnimationDataPairs.push({ node, data: animationData as AnimationData[] });
animationData.forEach(d => node.removeData(d));
}
});
// CALL AR FUNCTION
// add the animation data back to the nodes
nodeAnimationDataPairs.forEach(pair => {
pair.data.forEach(d => pair.node.addData(d));
});
nodeAnimationDataPairs.length = 0;
Cheers, Michael
1 Like
Hello @MajorMeerkatThe3rd ,
Thank you so much for reply and for the code example. I’ll folllow this approach to achieve the desired results.
Hello @MajorMeerkatThe3rd,
I followed your instructions and it’s solved now, thank you so much once again.