I am having difficulty figuring out how to properly achieve the effect I am looking for. I have a top down view, so gravity would be along the z axis, into the screen... so I don't set a gravity value.
The issue is that I can't get a body to move in response to controls the way I'd like.
Each iteration of the game loop I poll the keyboard, if the right arrow is down I set the force to (10,0), if no keys are down I set the force to (0,0). I am running into two issues with this, 1) I am applying a constant force so obviously the body continues to accelerate, and two removing the force does not affect the velocity of the body even though it stops accelerating.
I guess I am trying to achieve some sort of resistance force, applying a constant force should accelerate the body until a terminal velocity is reached, releasing the key should *quickly* slow then stop the body. I realize the resistance force alone wouldn't stop the object quickly enough for my liking.
The effect should really be similar to the controls you would expect from asteroid or geometry wars, but I don't particularly want to set a hard limit on velocity using cpBodySetVelLimit b/c I want to be able to upgrade the players ships engines to produce more force, thereby increasing their maximum velocity...
Does anyone have any tips on how I could get this to work?