Recently I started preparing a sample application for a project with wikitude. I have multiple AR.Trackable2DObject instances, so I arranged them in an array. I added some buttons (AR.ImageDrawable) for each trackable as augmentations. Now I try to figure out the best way to manage for creating and clearing drawables and animations.
The AnimationGroup object is created with an array (propertyAnims) containing the AR.PropertyAnimation objects for each drawable. World.animations = new AR.AnimationGroup(AR.CONST.ANIMATION_GROUP_TYPE.PARALLEL, propertyAnims);
The clearing is done this way: Drawables are removed from the cam: World.trackables.drawables.removeCamDrawable(World.augm);
Drawables are destroyed: World.augm.destroy(); World.augm = null;
Is it okay to destory the AR.AnimationGroup instance before the related drawables are destroyed? I would add a function for that.
clear: function clearFn(ii) { if (World.animations) { if (!World.animations.destroyed) { World.animations.destroy(); } World.animations = null; } }
Is it sufficient to destroy the AnimationGroup? Are the related PropertyAnimation objects disposed too? Should I destroy the group before I recreate it (e.g. for other drawables that are added dynamically to the cam)?
Marc Meyer