Cap Force/Velocity? (I made a PayPal donation)
Posted: Fri Jul 17, 2009 2:13 pm
Am I going to publicize my PayPal donation (confirmation # ending in 76059) in hopes of getting help on the forums? Yes, yes I am.
Does anyone know how I can cap the force or velocity of objects?
I have several cpBodies (circles, specifically) being displayed in an iPhone game. You can use your fingertip to push circles out of the way (i.e., an invisible circle exists under your finger and pushes the other bodies out of the way). You can also tap directly on the circles--which are about the size of your fingertip--and drag them around.
The problem is that if you start pinching several of the circles together one of them will occasionally shoot off with a ridiculous velocity (enough to escape the bounds of the game).
I'm thinking one (perhaps not the best) simple way to fix this is to figure out how to set a max velocity or force. Is a custom velocity integration function (e.g., cpBodyUpdateVelocity()) the best way to do this? I realize that I could also modify the timestep iterations (or even the thickness of my bounding box walls) to help keep objects on the screen, but the objects would still "shoot off" at crazy speeds and look weird.
Thanks for your help!
Does anyone know how I can cap the force or velocity of objects?
I have several cpBodies (circles, specifically) being displayed in an iPhone game. You can use your fingertip to push circles out of the way (i.e., an invisible circle exists under your finger and pushes the other bodies out of the way). You can also tap directly on the circles--which are about the size of your fingertip--and drag them around.
The problem is that if you start pinching several of the circles together one of them will occasionally shoot off with a ridiculous velocity (enough to escape the bounds of the game).
I'm thinking one (perhaps not the best) simple way to fix this is to figure out how to set a max velocity or force. Is a custom velocity integration function (e.g., cpBodyUpdateVelocity()) the best way to do this? I realize that I could also modify the timestep iterations (or even the thickness of my bounding box walls) to help keep objects on the screen, but the objects would still "shoot off" at crazy speeds and look weird.
Thanks for your help!