Open elemel opened 15 years ago
Box2D prismatic joints have a motor. See if we can use that to handle the recoil. The motor pushes the cannon rimwards. The impulses from the shots will push it hubwards. It's probably easiest to leave the motor on all the time.
Create Box2D bodies for all cannons and attach them to the cannonball body with prismatic joints. Also use damped springs for stability and recoil handling. Apply an impulse on the cannon when firing, corresponding to the impulse propelling the shot.