Question about joint behaviour,
I'm trying to make a "rigid" feeling revolute joint that can be controlled by the user, so they can map keys to rotate it clockwise and counter-clockwise, and when they aren't pressing a key, the joint tries to stay exactly where it is.
Currently what I'm doing is whenever no keys are pressed, I set the motor speed to zero, and greatly increase the max motor torque. Then when a key is pressed, I set the max motor torque back to normal, and set the motor speed to some number.
The problem I'm encountering is that occasionally I run into the situation where if there's a strong force opposing the motor (such as gravity), the motor will rotate in the wrong direction when a key is pressed, but will remain rigid when no keys are pressed. Ideally I'd like it to be able to detect when this will happen, and just treat it as if no key is being pressed in this case.
So my question is, is there any way of detecting the forces acting on a joint? They must be computed at some point during the physics step, but is there an easy way of detecting them from outside a physics step? Or is there an easier way of going about this whole thing that I'm completely missing?
I'm trying to make a "rigid" feeling revolute joint that can be controlled by the user, so they can map keys to rotate it clockwise and counter-clockwise, and when they aren't pressing a key, the joint tries to stay exactly where it is.
Currently what I'm doing is whenever no keys are pressed, I set the motor speed to zero, and greatly increase the max motor torque. Then when a key is pressed, I set the max motor torque back to normal, and set the motor speed to some number.
The problem I'm encountering is that occasionally I run into the situation where if there's a strong force opposing the motor (such as gravity), the motor will rotate in the wrong direction when a key is pressed, but will remain rigid when no keys are pressed. Ideally I'd like it to be able to detect when this will happen, and just treat it as if no key is being pressed in this case.
So my question is, is there any way of detecting the forces acting on a joint? They must be computed at some point during the physics step, but is there an easy way of detecting them from outside a physics step? Or is there an easier way of going about this whole thing that I'm completely missing?