best way to do turbo

Hi guys, I am making a 2d sidescrolling racing game, and I want to introduce a turbo that doesn't use the wheels (i.e. it works also on the air). Obviously the problem is the stability, because the car is longer on the x axis, so my idea was to pull the car from the front, and I am not achieving that. I am using this

body.applyLinearImpulse(new Vector2(1,0), new Vector2(body.getWorldCenter().x+m_size.x/2, body.getWorldCenter().y));

It looks like independently on where I apply the impulse, the car is being pushed from behind, and the back part of the car goes up and the car turns upside down. So what would you say it is a decent way to do this and why isn't it working as I would expect?

Thanks.
Are you applying the same impulse to the wheels and other bodies that are joined to the chassis?
How about applying the force/impulse at the center of mass of every body involved... no offsets.
Yes, that makes it a lot more stable, at least when it is on the ground. Thank you.
I am having the same problem again. I have this code for the turbo:

body.applyLinearImpulse(new Vector2(5,0), body.getWorldCenter());
frontWheel.applyLinearImpulse(new Vector2(5,0), frontWheel.getWorldCenter());
rearWheel.applyLinearImpulse(new Vector2(5,0), rearWheel.getWorldCenter());

The car only has this three things plus the wheeljoints, it is that simple, I don't know why this is giving me so many problems, for jumping I am using the same but on the y axis and it goes correctly. The wheeljoints are created like this, and the problem dissapears if I disable the motor of the wheeljoints (that would be on the ground, on the air it is still horrible).

Code:
             WheelJointDef jd = new WheelJointDef();
         jd.initialize(
           this.body,
           this.rearWheel,
           this.rearWheel.getWorldCenter(),
           new Vector2(0.0f, -1.0f));
         jd.enableMotor = false;
         jd.maxMotorTorque = 1000.0f;
         jd.frequencyHz = axleFreq;
         jd.motorSpeed = -m_maxspeed;
         WheelJoint myjoint = (WheelJoint)physicsWorld.createJoint(jd);
         jd.initialize(
                this.body,
                this.frontWheel,
                this.frontWheel.getWorldCenter(),
                new Vector2(0.0f, -1.0f));
         WheelJoint myjoint2 = (WheelJoint)physicsWorld.createJoint(jd);
Assuming the wheels are smaller and lighter than the car body, you'd have to apply a smaller impulse to them, sorry should have mentioned that.
Thank you very much, you are helping me a lot. Now the turbo works perfect on the air, but I'm afraid that on the floor the behavior is the same. I have put a workaround: setting the torque of the front wheeljoint to 1 instead of 1000, that makes the turbo work on the ground at last, but now on hills the car sometimes "gets up" on one wheel so it is not a definitive solution.

Now I don't know if this is the expected behavoir or I am doing something wrong with the wheeljoint. On the debug mode I am seeing the lines of the wheeljoint going from the origin (0,0) of the body of the car, I don't know if that is correct:

Image
You mean 'gets up' so that only the front wheel is on the ground? I wonder if it could be catching on the tiles in the ground, assuming your hills are made that way too. Does the turbo impulse also pull the bodies directly sideways when the car is on a hill, or does it take the hill slope into account?
I will try to explain myself the best I can, because I am not completely sure what you men (I'm not an english speaker).

first of all, the turbo right now looks like this:

Quote:
body.applyLinearImpulse(new Vector2((float)(m_turbo*body.getMass()*Math.cos(body.getAngle())), (float)(m_turbo*body.getMass()*Math.sin(body.getAngle()))), body.getWorldCenter());
frontWheel.applyLinearImpulse(new Vector2((float)(m_turbo*frontWheel.getMass()*Math.cos(body.getAngle())), (float)(m_turbo*frontWheel.getMass()*Math.sin(body.getAngle()))), frontWheel.getWorldCenter());
rearWheel.applyLinearImpulse(new Vector2((float)(m_turbo*rearWheel.getMass()*Math.cos(body.getAngle())), (float)(m_turbo*rearWheel.getMass()*Math.sin(body.getAngle()))), rearWheel.getWorldCenter());


so on the floor it goes forward, on a hill on the direction of the hill, etc. The problem with turbo is exactly like this: the back part of the car goes up when the wheels are touching ground, the impression it gives me is like the front wheel doesn't want to change speed and because of the impulse then the car flips (like when someone brakes the front wheel of a bike). I "solved" it putting all the strength on the back wheel, now why I say that this gives problems on hills? It is not that it gives problems using the turbo on hills, it is just going up an inclinate hill causes the car to lift the front part (exactly the opposite of the "turbo problem") because the rear wheel now is very potent and the front is not, that is why I considered this some kind of workaround because ideally both wheels should have the same strength.

btw, the hills are made of the same kind of tiles, but it looks like this is not caused by that, I just think that because of the inclination (45º) the strength of the rear wheel is enough to flip the car, but this does not happen when both wheels have the same strength.
I wonder if it would help if you made the friction of the wheels zero while the turbo is in effect...
Thanks for your recommendation. I have still not tried this because right now the behavoir is "good enough" and box2d doesn't support a clean way to change the friction in the middle of the emulation, so I've moved on to other parts of my project. When I try that I'll post the result here for the people that could have this problem in the future.

Original thread: https://box2d.org/forum/viewtopic.php?t=8890