-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Breaking' constraints if some threshold of force is applied to them? #229
Comments
I just added a .multiplier property to Equation which enables this, as well as a demo showing how to use it. The strategy is to look at the absolute value of the .multiplier and remove the constraint from the world if the multiplier is too big. (multiplier is proportional to the force applied by the constraint). For the HingeConstraint, you'd probably have to look at all equations and check the .multiplier. Or if you just want the constraint to break by twisting, just check the rotational equations :) |
AWESOME :D thanks for adding that! I don't really understand the concept of equations/multipliers in the context of physics engines - would I sum the multipliers from each equation, or average them, or..? Also, I'd be cool if I could work out the actual force on the constraint (just a scalar) from the multiplier values - or at least get some close approximation. Is that possible? |
Having a read through https://en.wikipedia.org/wiki/Lagrange_multiplier and it seems maybe a little more complicated than I was assuming... |
I think the force is the multiplier times the Jacobian - it should be possible to resolve the force (and torque). I guess you can get your "force scalar" from that in a way you like. Or just use the multiplier, it should be good enough for most cases. If you have multiple equations you need to sum or use some weighted average on the multipliers/forces. Depends on how you want your constraint to break. Start off with a simple sum and see what you get :) |
Thanks man, I'll have a play around. My goal is to be able to set a threshold that will make both hinge constraints and lock constraints break under the same force - I'll let you know here if I make any progress :) |
Is there some way to test the force which a constraint such as a hinge or lock is sustaining at any given time instant? Perhaps its hiding in one of these properties?
As the title says, I'd like to give each constraint a force at which the joint breaks.
As a possible backup plan: If I could get the total force on each body before the forces from the constraints have been applied, then I think I could work out the force on the joint without too much trouble (though actually, now that I think about it, maybe I'd need to consider any torques too?).
The text was updated successfully, but these errors were encountered: