feat: Bepu, getter to retrieve the impulse and force applied by a given constraint#2930
Conversation
| public abstract bool Attached { get; } | ||
|
|
||
| /// <summary> | ||
| /// Returns the squared sum of all impulses this constraint applied on the last tick |
There was a problem hiding this comment.
Just a nit: The doc says "Returns the squared sum of all...", but your implementation above does a MathF.Sqrt(). Is that correct?
There was a problem hiding this comment.
Good catch, I intended to replicate bepu's api on that front, but ended up forcing a sqrt as I did not see any cases were one would prefer a squared version. I'll make a PR in a bit to fix this.
There was a problem hiding this comment.
Normally squared versions are nice for checking relative magnitudes (i.e. checking if not zero, or comparing A > B, or comparing against a precomputed threshold). In those cases, it is sufficient to get the squared magnitude and save a square root.
Anyway, I'm not very into physics simulations these days, so you may know better 😀.
PR Details
See title. Could be used to detach a constraint when under too much strain, dynamically measure a constraint to adjust other constraint strengths, play different straining sound effect based on those values, ...
Related Issue
None.
Types of changes
Checklist