I’m creating an evolution simulator using cocos2d-x, which uses the physics engine extensively. As you can guess, I need to control the speed of the simulation.
In the scene where I want to control the speed, I’d set the Director’s Scheduler’s time scale along with PhysicsWorld’s speed, like this:
However, setting the
SPEED too high (e.g. 10) would cause weird behaviors to happen - such as objects getting inside static objects. I only apply force and impulse to control the motion of objects. So for example, a jumping character would escape the platform and fall down if I speed it up beyond a certain point.
I have few questions:
- Am I doing anything wrong here?
- Is there a better way to control the speed of the entire scene?
- Is there a limit to the speed I can set before the system breaks down?
I’d also like to know if I can make cocos2d-x calculate a specific amount of game steps before rendering. So, let’s say, the simulation will reach a specific state after a specific number of game steps - can I just make cocos2d-x calculate the steps and reach that state as fast as possible?