I have the following simulation. The gray leg has an upper leg (dark-gray) and lower leg (light gray) connected by a hinge joint (like a knee, brown). I've connected a body (muscle part as so to speak, in red), using a hinge joint to both of them. Now I've connected the two muscle parts (red) together using a slider joint. The idea is to use the linear motor in the slider joint (blue) to contract and expand the muscle in order to actuate the knee joint.

When the motor is disabled the simulation seems to work fine, the muscles behave as expected and move closer when the knee bends. So I tried enabling the linear motor on the slider joint:
Code: Select all
slider->setPoweredLinMotor(true);
slider->setMaxLinMotorForce(50);
slider->setTargetLinMotorVelocity(-1.0f); // negative value to contract
In my dummy simulation (without gravity) this works fine. The knee is slowly actuated and the leg bends. Now when I enable gravity the leg obviously falls over, but it should still be able to contract, given enough force. This is where the weird thing happens. No matter what I set MaxLinMotorForce to the leg will not contract when on the ground. There seems to never be enough force to lift to 'pull the upper leg up'. When the leg is on its side there is enough force to overcome friction and pull very slowly together but the speed of this does not depend on the TargetLinMotorVelocity and the MaxLinMotorForce. (note that I call TargetLinMotorVelocity every frame)
Also setting a TargetLinMotorVelocity of 0.0 doesn't seem to work at all, no matter what the force is the knee still bends quite easily. So, am I missing something here? I tried diving into the source code but there seems to be nothing special concerning the linear motor.
TLDR: how do I make the slider joint LinearMotor more powerful, MaxLinMotorForce doesn't seem to work.
EDIT: the limits seem to affected similarly, when I impose strict limits (to almost freeze the knee) the forces aren't enough to counter outside forces, but in rest it will return to the limits.