joint for tank cannon

Jan 23, 2010 at 1:53 PM

Hi.

I  am creating tank that consists of independent rotating base and tower+cannon.

When cannon shoots it "rolls back into the tower" and then returns to normal position in front of the tower.

I created this effect with applying force to cannon "boxBody4.ApplyForce(fireForceInverse);" 

initially in tower`s opposite direction and then move it back in tower`s front direction.

As a result i have effect of shooting cannon.

But I have a problem. There is shifting of the cannon position after ApplyForce operations.

I thought that i can solve it by fixing cannon with tower using Joint, but i did not understand the way how could i do it?

Help me please with small example if you can.

Thanks a lot.