Armature CCBatchNode childrens all have same positions

Armature CCBatchNode childrens all have same positions
0.0 0


Hi all,

I’m using CCBatchNode to batch draw all my armature. All the children’s in the BatchNode all have different position and anchor.
However they all drawing in the same position. They are position fine if they are not added to BatchNode

CCBatchNode* batchnode = CCBatchNode::create();

for (int i = 0; i < 5; i++)
Armature *armature = Armature::create(“Cowboy”);
batchNode->addChild(armature, 0, i);



Hi obi,

I had a similar problem. It looks like the position, etc. of the armature are applied to the transformation stack but then popped before they can be rendered when using a CCBatchNode. I managed to work around this (for position) by applying the position to a root bone in the armature instead of on the armature node itself.

Basically, I created a class that extended CCArmature and overrode the setPosition() function like so:

void RootOverrideArmature::setPosition(const CCPoint& newPosition)
   //Set position to root bone instead of the node itself b/c node's position goes into the transformation matrix which is ignored by batch armature drawing 

   //m_obPosition = newPosition;
   //m_bTransformDirty = m_bInverseDirty = true;

   CCBone* pRootBone = getBone("root"); 

After that, I had my artists agree to make a “root” bone that they never animate to which other bones in the armature are parented.

Hope this helps!