bevy
bevy copied to clipboard
fix: Ensure linear volume subtraction does not go below zero
fix: Ensure linear volume subtraction does not go below zero
Solution
- Clamp the result of linear volume subtraction to a minimum of 0.0
- Add a new test case to verify behavior when subtracting beyond zero
I think it's worth to discuss whether to keep these impls or not, but while we have them, we should at least not use abs
My recommendation would be for this PR to remove the impls, and mark this a breaking change in case people have accidentally/intentionally relied on this impl existing.
removed the impls and replace add with increase_by_percentage
It looks like your PR is a breaking change, but you didn't provide a migration guide.
Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.
@alice-i-cecile marked this as breaking because it removes the Add/Sub impls on Volume, don't know if that's okay
Let's just make sure nothing calls abs :eyes:
We should keep the Add and Sub impls intact, and just call the corresponding methods in them + document exactly what they do.
I disagree. The impls as they stand are wrong, and changing them to call "the right methods" would make them the same as the Mul and Div impls, which in turn would make it more confusing than it is worth IMHO. To me, this justifies the breaking change.
Besides, changing their implementation is still a breaking change in that they will have fundamentally different behaviors which which will break existing code.