Why CCShakyTiles3D doesn't work on CCSprite created from CCSpriteBatchNode?

Why CCShakyTiles3D doesn't work on CCSprite created from CCSpriteBatchNode?
0.0 0


I’m using cocos2d-2.1beta3-x-2.1.1 on win32, I have found a bug.
I want to use CCShakyTiles3D effect on my sprite, but if the sprite is created from CCSpriteBatchNode, there is no effect. But if the sprite is created directly from an image, the effect is OK.

Why ?

        CCSpriteBatchNode *spriteBatchNode = CCSpriteBatchNode::create("TestEffect.png");

        CCSprite* pSpriteA  = CCSprite::createWithSpriteFrameName("Normal.png");
        pSpriteA->setPosition(ccp(winSize.width/2, winSize.height/2));
        spriteBatchNode->addChild(pSpriteA, 2);
        this->addChild(spriteBatchNode, 1);

        // pSpriteA has no shaky effect, just a static image, why????????
        CCActionInterval* pShaky1 =CCShakyTiles3D::create(3000, CCSizeMake(50,50), 5, false) ;

        CCSprite* pSpriteB = CCSprite::create("NormalB.png");
        pSpriteB->setPosition(ccp(winSize.width/2, winSize.height/2 + 200));
        this->addChild(pSpriteB, 1);

        // pSpriteB has the right shaky effect.
        CCActionInterval* pShaky2 =CCShakyTiles3D::create(3000, CCSizeMake(50,50), 5, false) ;


anyone knows?


This is probably because a spritebatch node never tells its children to draw themselves (normal nodes draw themselves then all of their children).

I believe that spritebatchnode just grabs the transformation of its children - scale, position, rotation ect.
and then draws them all in one swoop. thats where the speed comes from. and thats what you are using to speed up the process,

so it cant work on a batched sprite. (but you can apply a grid to the whole batch)