If you look at the documentation comments for the function PhysicaWorld::setSpeed()
/**
* Set the speed of this physics world.
*
* @attention if you setAutoStep(false), this won't work.
* @param speed A float number. Speed is the rate at which the simulation executes. default value is 1.0.
*/
inline void setSpeed(float speed) { if(speed >= 0.0f) { _speed = speed; } }
You’ll see this feature only works with autoStep enabled. The reason is because PhysicsWorld scales delta time by speed internally during the auto step.
You can replicate this behaviour manually like so:
void GameScene::update(float delta)
{
/*update code is here not show in this psudeo code */
float speed = 2;
auto scene = Director::getInstance()->getRunningScene();
scene->getPhysicsWorld()->step(delta * speed);
}
However it is also worth noting that if your GameScene::update() is called every frame with a variable dt, the physics simulation will be unstable.
See these discussions for more detail: