Skip to content
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

Revert "Fix hints on PhysicsMaterial bounce/friction." #48321

Closed
wants to merge 1 commit into from

Conversation

madmiraal
Copy link
Contributor

Reverts #42203

Fixes #48298

@akien-mga
Copy link
Member

Maybe we should also improve the documentation for these properties to clarify what values they can take (e.g. which range preserves conservation of energy, and what clamping happens behind the scenes which can modify the input values).

@pouleyKetchoupp pouleyKetchoupp requested a review from a team April 30, 2021 15:41
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment on range hints.

Also as a note, PhysicalBone3D has its own properties for friction and bounce and enforces values in 0..1 range. It would be better to make things consistent and use PhysicalMaterial there too, but that's a bit out of the scope of this PR.

Comment on lines -46 to +48
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "friction"), "set_friction", "get_friction");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rough"), "set_rough", "is_rough");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_bounce", "get_bounce");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bounce"), "set_bounce", "get_bounce");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to let users set higher values, but ,or_greater should be added instead of removing the range entirely, since negative values are not useful (rough and absorbent are meant to be used instead and their effect is documented) and the interval 0..1 is still a good hint for common cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purely a revert of #42203 to fix the regression. I think any new changes should be made in a separate PR, where they can be discussed, agreed (or left unmerged due to a lack of consensus) and, if necessary, reverted if they're wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no point in reverting the PR myself, since by far for most use cases it is useful and an improvement over what was in there. I would do a separate PR with or_greater hint for the rare cases where you really want to go over 1.0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just opened #48434 to add or_greater hint instead of reverting the range.

@akien-mga
Copy link
Member

Superseded by #48434.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Friction in PhysicsMaterial is too low even at 1.0 (the max)
4 participants