HingeJoint motor force not working (it does nothing)

See the video. I have a hinge joint motor and whether I set the “force” to 50, or 50,000, it seems to behave the same way. In the video, the weight of a few tennis balls are stopping the motor regardless of the force. The weight of the tennis balls is 3kg, which I know is more than a real tennis ball, but still it seems like changing the force value should change the behavior, and that a large force value should be able to overcome the weight of a few balls.

Does anyone have any thoughts about what I’m doing wrong? Thanks.
The code:

  HingeJoint hj = hingeObject.GetComponent<HingeJoint>();
        if (!hj) { hj = hingeObject.AddComponent<HingeJoint>(); }
        hj.connectedBody = connectedBodyRigidbody;
        hj.anchor = new Vector3(0f, 0f, 0f);
        hj.axis = new Vector3(0f, 1f, 0f);
        hj.connectedAnchor = new Vector3(0f, 0f, 1f);
        hj.useMotor = true;
        JointMotor jm = hj.motor;
        jm.targetVelocity = targetvelocity;
        jm.force = force*50f;
Debug.Log("jm.force=" + jm.force); //this prints "50000" when I use force=1000

If I increase the targetVelocity, then the motor is able to carry the weight of the balls for long enough to complete the revolution, but this isn’t what I want. I want the option to have a slow moving motor with a high torque capable of moving whatever weight that is provided.

I figured this out. I should have known what the issue was right away. The mass of the motor was too low (set to 1kg) so it makes sense that it couldn’t move much heavier objects. Increasing the mass gave it the power I was expecting.

1 Like

Thanks Spanky I searched a lot, thinking that it should function, but never realized that the mass affects the performance of the joint motor.

CHANGE THE MASS OF THE JOINT !!!

couple years late but, u gotta add hj.motor = jm at the end. Editing the variable doesn’t actually edit the componen

2 Likes