PhysicsBody isn't moving with its Layer. Cocos2d-x 3.0 RC0

PhysicsBody isn't moving with its Layer. Cocos2d-x 3.0 RC0
0.0 0


Hello there,

I have an issue can someone please help me solve it? I have made a level which has some scroll features with work by moving the layer, but when I have added physicsBody to my sprites which are in my layer the scroll feature doesn’t work at them. they stay wat the same position. But I want to make them move along with the layer.

I am using Cocos2d-x 3.0 RC0

This is a sample of what I mean.

To create a sprite
Sprite* testBuildS = Sprite::create(“Test.png”);
this->addChild(testBuildS, 4);

And i move my layer just with

Thanks for reading.


Did you created a gravity world?

Scene* PhysicsLayer::createScene()
// add following codes
auto scene = Scene::createWithPhysics();

auto layer = HelloWorld::create();
return scene;

please see: [[]]


Yes I did I even tried to move the layer in this sample i found on wiki “” but the problem still exists the layer is moving but items with physics body stay on the same place.


yeah, setting layer’s position will be not linked to the physics world in 3.0rc.

I asked the developer for help.

They told me that the only way to achieve scroll feature is to move the physical bodies by yourselves in 3.0rc.

Or you can use v2.x version.



Thanks for your answer.
But is there actually a way to use box2d without using inbuilt cocos2d-x physics system? Beacuse I couldn’t find ENABLE_BOX2D_INTEGRATION anywhere. I have seen some classes check for it but I haven’t found a class which defines it.


Move Complete Scene.