I want to have a button which detects the weight on top of it and depresses.
The more weight put on the button, the farther it goes into the ground, but it shouldn't rotate at all or move side to side.
I think what I want is similar to a critically damped spring, so that it returns to equilibrium as fast as possible without oscillating too much when the amount of weight changes. But the amount of damping required depends on the weight. Should I just tune it for the most common weights and hope for the best? I'm worried about stability in cases of huge weights.
More importantly, what is the best way to implement such a spring? Should I manually set the force each frame based on current position and velocity of the button?
Currently, I'm using a line joint with motor and limits, but it doesn't work as well as I'd like. Not only does it not actually model a spring, it sometimes has unstable behavior, even under normal loading. Sometimes it goes rapidly up and down each frame for no discernible reason.
The more weight put on the button, the farther it goes into the ground, but it shouldn't rotate at all or move side to side.
I think what I want is similar to a critically damped spring, so that it returns to equilibrium as fast as possible without oscillating too much when the amount of weight changes. But the amount of damping required depends on the weight. Should I just tune it for the most common weights and hope for the best? I'm worried about stability in cases of huge weights.
More importantly, what is the best way to implement such a spring? Should I manually set the force each frame based on current position and velocity of the button?
Currently, I'm using a line joint with motor and limits, but it doesn't work as well as I'd like. Not only does it not actually model a spring, it sometimes has unstable behavior, even under normal loading. Sometimes it goes rapidly up and down each frame for no discernible reason.