Camera movement

Hello. Why everybody doesn’t like camera moving and prefer layers moving instead?
So I have a debug draw layer and the main layer with CCSprites. I don’t think that moving both layers together is a good idea, isn’t it? So I wrote a helper-layer with the code:

void cc::Camera::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
{
    CCSetIterator it = pTouches->begin();
    CCTouch* touch = (CCTouch*)(*it);

    CCPoint prev = touch->getPreviousLocation();
    CCPoint now  = touch->getLocation();

    CCPoint movement = ccpSub(prev, now);

    float x, y, z;
    mCamera->getEyeXYZ(&x, &y, &z);

    mCamPos.x += movement.x;
    mCamPos.y += movement.y;

    mCamera->setCenterXYZ(mCamPos.x, mCamPos.y, 0);
    mCamera->setEyeXYZ(mCamPos.x, mCamPos.y, z);
}

Seems that mCamPos is okay after changes but nothing happens in the world. setCenter and setEye doesn’t affect the scene :(. mCamera is the pointer taken from: CCDirector::sharedInstance()->getRunningScene()->getCamera();

i agree with u!i also do it with camera

When I decided how to implement the scroll I came across this post:

Explains more or less 4 ways to implement camera scrolling.

I personally choose the same as you, this is how I move my background layer (simplified):

    float xNewPos,yNewPos;
    float xEyePos,yEyePos,zEyePos;

    // First we get the current camera position. In this case Scroll = camera position
    this->getCamera()->getCenterXYZ(&cameraPosX,&cameraPosY,&cameraPosZ);
    this->getCamera()->getEyeXYZ(&xEyePos,&yEyePos,&zEyePos);

    // Calculate the new position
    xNewPos = cameraPosX - deltaX;
    yNewPos = cameraPosY - deltaY;

    this->getCamera()->setCenterXYZ(xNewPos,yNewPos,cameraPosZ);
    this->getCamera()->setEyeXYZ(xNewPos,yNewPos,zEyePos);      

As you can see I move the camera attached to the current layer (the class “this” is extending a CCLayerColor), not the whole scene. Could be that the problem?