Hi all,
So I have the following gameplay mechanic in my Unity game: the player has to punch or kick a punch bag and it has to swing back and forth. The player is represented by a 3D model with a Rigid Body attached to it (screenshot #1 below). Also, there are Capsule Colliders and Rigid Bodies attached to his Left Arm, Left Hand, Left Leg, Left Foot, Right Arm, Right Hand, Right Leg, and Right Foot (look at screenshot #2).
The punch bag in question is attached to an object named PunchBagFixture. It's basically a cube with a Rigid Body and a Fixed Joint (look at screenshot #3). The Fixed Joint is not attached to any objects and its Break Force and Break Torque are set to Infinity. The punch bag (object Boxing_Pear_1) is attached to that PunchBagFixture via a HingeJoint, and it also has a Rigid Body and a Capsule Collider (screenshot #4).
The problem is that once in a while after punching or kicking the bag, it swings backwards, then it swings forward, bounces off of the player and gets stuck in the terrain (screenshot #5). I don't know how to prevent that. I've tried setting different values for the Mass and Drag parameters of the punching bag's Rigid Body, as well as the Spring and Damper parameters of its Hinge Joint, but nothing helps. I have a collider on the terrain as well and I've tried removing it, with no success either.
What can I do to fix this? Should I make the RigidBody of the punch bag Kinematic, or should I perhaps disable the collision on the player, after he hits the bag, so the punch bag doesn't bounce off of him (although I kind of like that feature because it makes it more realistic)? Or should I do some kind of scripting for the Rigid Body or Hinge Joint?
Thanks.