Move DebugDraw layer with Scene layer

Hi!

I have a scene layer (tiles), which moves while my player is moving.
When I enable box2d debug draw functions, debug layer with all boxes doesn't want to move together with scene layer.
How to solve this problem? How to move or update debug output boxes with scene?

Thanks.
It sounds like you are drawing your tiles or sprites or whatever without asking the physics engine where they should be.
Usually you would use GetPosition and GetAngle to find the location of things, and draw them where the physics engine says they are - then you would not have this problem.
Ok =) But how should I implement this?
Here is my update method:
Code:
-(void) update: (ccTime) dt
{
    // Iterate over the bodies in the physics world
    for (b2Body* b = world->GetBodyList(); b; b = b->GetNext()) {
        if (b->GetUserData() != NULL) {
            CCSprite *sprite = (CCSprite*)b->GetUserData();
            sprite.position = CGPointMake(b->GetPosition().x * PTM_RATIO, b->GetPosition().y * PTM_RATIO);
            sprite.rotation = -1 * CC_RADIANS_TO_DEGREES(b->GetAngle());
        }
     }

    // Step
    int32 velocityIterations = 8;
    int32 positionIterations = 1;
    world->Step(dt, velocityIterations, positionIterations);

    // Move map with player
    CGPoint direction = [self getPoint:playerBody->GetPosition()];
    [layer setPosition:direction];
}
That looks fairly reasonable.
Is the debug draw being drawn into the same layer as this? If so, it should move together because the setPosition would affect them equally. If the debug draw is in a different layer, then you would have to do the same setPosition for that layer as well.
irresistible force wrote:
That looks fairly reasonable.
Is the debug draw being drawn into the same layer as this? If so, it should move together because the setPosition would affect them equally. If the debug draw is in a different layer, then you would have to do the same setPosition for that layer as well.

Thank you! You was right. I drag only the tmx map, and I should have to drag a layer. And my second mistake, that I had 1 layer for physic layer and 1 for game layer (tmx map).

Original thread: https://box2d.org/forum/viewtopic.php?t=9810