Revolute joint(joint speed)

Hi,

if(leftWheelRevoluteJoint)
{
leftWheelRevoluteJoint.SetMotorSpeed(50*Math.PI * (kbd.isKeyPressed(40) ? 1 : kbd.isKeyPressed(38) ? -1 : 0));
leftWheelRevoluteJoint.SetMaxMotorTorque(kbd.isKeyPressed(40) || kbd.isKeyPressed(38) ? 30 : 0);
}
if(rightWheelRevoluteJoint)
{
rightWheelRevoluteJoint.SetMotorSpeed(50*Math.PI * (kbd.isKeyPressed(40) ? 1 : kbd.isKeyPressed(38) ? -1 : 0));
rightWheelRevoluteJoint.SetMaxMotorTorque(kbd.isKeyPressed(40) || kbd.isKeyPressed(38) ? 25 : 0);
}
if(leftAxlePrismaticJoint)
{
leftAxlePrismaticJoint.SetMaxMotorForce(30+Math.abs(800*Math.pow(leftAxlePrismaticJoint.GetJointTranslation(), 2)));
leftAxlePrismaticJoint.SetMotorSpeed(-50*Math.pow(leftAxlePrismaticJoint.GetJointTranslation(), 1));

}
if(rightAxlePrismaticJoint)
{
rightAxlePrismaticJoint.SetMaxMotorForce(30+Math.abs(800*Math.pow(rightAxlePrismaticJoint.GetJointTranslation(), 2)));
rightAxlePrismaticJoint.SetMotorSpeed(-50*Math.pow(rightAxlePrismaticJoint.GetJointTranslation(), 1));
}
carBody.ApplyTorque(40*(kbd.isKeyPressed(37) ? -1: kbd.isKeyPressed(39) ? 1 : 0));


This is the code i'm using for bike movement by pressing the left and right arrow.

if i'm not pressing any key, the bike movement is still there for more then five seconds. But i want the bike should stop immediately.

so that i checked the revolutejoint motor speed and it shows zero. But the revolutejoint joint speed is not zero.

like this i have checked for joint speed(trace(leftWheelRevoluteJoint.GetJointSpeed())).

how can i get rid of this?
If the motor torque is zero the wheel is free to turn with no resistance.
You need to keep the 'max motor torque' at a higher value so the motor will stop the wheel turning, even when no key is pressed.
thanks 😀

if the bike got flip, i have to finish the game. should i need to destroy all the bodies?

if i destroying the bodies, the bike parts are changing the position and i do not know what to do exactly.

have to do it like this
http://www.gamenode.com/sports-games/fmx-team/

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