How to set the rotation angle for sprite with a bone at current animation frame? I tried with the code but didn't work. Most of the sprites are all right, but some of them are not the same rotation angle with the bone.
spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
spAtlasRegion *region = (spAtlasRegion *)attachment->rendererObject;
CGRect rect = CGRectZero;
if(region->rotate) {
rect = CGRectMake(region->x * 0.5, region->y * 0.5, region->height * 0.5, region->width * 0.5);
}
else {
rect = CGRectMake(region->x * 0.5, region->y * 0.5, region->width * 0.5, region->height * 0.5);
}
CCSprite *sprite = [CCSprite spriteWithTexture:batchNode.texture rect:rect];
sprite.rotation = ((region->rotate ? 90 : 0) - attachment->rotation - slot->bone->worldRotation);
Image supprimée en raison de l'absence de support de HTTPS. | Afficher quand même
The right is the spine skeleton, which is right.
The left are the sprites I created from the skeleton, but the rotation angle of some bones are not right, such as the right arm, the right leg. I don't know why.
Thanks!