I'm trying to use a simple robotic hand in an open environment to interact with a pyramid shaped object. Everything seems to be mostly working, however the hand can bounce off to infinity under certain circumstances. I suspect this is to be expected for an expert, but I'm new to the engine so I'm sure I'm doing something stupid.

What I'm aiming for is a freely moving hand that is flat unless the user deliberately rotates the palm out of the horizontal plane. In previous iterations of the code, moving the hand up and down would cause the hand to torque and rotate such that the thumb was pointing either up or down. I fix this by setting the angularDamping with the p.changeDynamics function, but I suspect this may be causing the bouncing off to infinity issue.

I've recorded a screencast of the hand bouncing off to infinity, as well as provided a gist of all the code and model files.

Folks, I realized my original code may have been unclear, due to the presence of the ahead_view() and down_view() functions, as well as the fact I was using gist - which is probably the worst medium for this problem.

This seems to make the hand more rigid during collisions - meaning that when I ram the hand into the pyramid it maintains its pointing gesture, minus the deflection of the index finger.

Removing the ahead_view() function completely, the hand will deform during collisions. Meaning that it will bend back onto the wrist.

I suspect that it is the rigidity of the hand induced during the call to ahead_view() that causes the hand to bounce off to infinity. If the energy of the collision doesn't go into deflecting and manipulating the hand, it has to go somewhere. In the absence of that outlet, the engine decides to impart the energy to the hand's base, causing it to fly off.

So to recap - I have fixed the issue with the hand bouncing off to infinity, but it seems to be caused by the p.addUserDebugLine() function - no idea why. Can someone clarify the behavior for me?