Is there a way to pause Chipmunk PhysicsWorld?

  • barabasandras1
    Likes 0

    Problem Description

    Somehow? I don’t want to iterate through every PhysicsBody in the PhysicsWorld and set ‘setEnable(false)’. It would clear any special force that affects the body anyway (for example rotation).

  • Sonar Systems admin
    Likes 0

    Chipmunk or Cocos2d-x built in Physics as they are built on top of Chipmunk?


    This reply has been verified.
  • barabasandras1
    Likes 0

    The one that you use in your videos. Cocos2d-x built in physics is chipmunk as well, isn’t it?

    The problem in nutshell: When I pause the body with either physicsBody->setEnable(false) or ->isResting(true)  and resume it, my AngularVelocity resets. The sprite that previously was rotating won’t do it anymore not even if I set AngularVelocity to the same value.


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Are you resuming both methods?


    This reply has been verified.
  • barabasandras1
    Likes 0

    Nope. If I set the body to resting, I only use setResting(false) when I want to resume it. But it won’t rotate anymore. Not even if I add setAngularVelocity again. It rotates for like 0.2 seconds but then stops.


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Have you applied the same properties?

  • barabasandras1
    Likes 0

    Yeah. But even if I apply x2 angular velocity value, the result is the same, it won’t rotate at all.


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Try setting the angular velocity to 0 then back again


    This reply has been verified.
  • barabasandras1
    Likes 0

    That did not work. Which method do you advise me to use? Setting isResting or just the setEnable()?


    This reply has been verified.
  • barabasandras1
    Likes 1

    OK something is totally wrong with my code. I just created a brand new test file where I add one new sprite and attach a psyhicsbody on it. I do the same thing with it (setEnable(false) or setResting() it doesn’t really matter but i’ll stick to resting) on a button touch and when I resume it the rotation is back again.


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Great :D

Login to reply