-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Improve physics body/shape scale warnings, check shear/global, add to 2D #79364
base: master
Are you sure you want to change the base?
Conversation
4415a30
to
9e5b147
Compare
9e5b147
to
dae26ef
Compare
dae26ef
to
108a8d0
Compare
108a8d0
to
4f31621
Compare
In #67847 I did not add the warnings to 2D because I could not reproduce the issues there. I did see some issues later with CCD when using non-uniform scale. Are there any open issues except for #12335? If you can reproduce issues with 2D, that would justify adding the warnings, but otherwise we maybe should wait with adding those to avoid annoying users unnecessarily (even if it may be teaching good practice). The code changes look good. |
@rburing I do not use 2D physics so I'm not sure, but many physics calculations don't quite work the same with non-conformal transforms. For example, circles would become ellipses. If it really works with Godot's physics I could remove it I suppose, however, I think it's still best to keep this check because 1) It's a good practice for physics objects to have conformal transforms and 2) What about third-party 2D physics engines like Box2D or Rapier2D, wouldn't it be a bad idea to assume all 2D physics engines support non-conformally transformed physics objects? |
4f31621
to
92dd2d3
Compare
92dd2d3
to
a000e02
Compare
a000e02
to
779a842
Compare
I guess I'll paraphrase myself from #88914 seeing as how there's a good amount of overlap here. I can't speak for 2D, but I would prefer to see these With Jolt you can non-uniformly scale boxes, cylinders (so long as X and Z stays the same), convex polygons and concave polygons without any issues. I don't know if the same holds true for Godot Physics. You can also scale physics bodies with Jolt to some degree as well. Seeing as how this PR (unlike #88914) also checks to see that the basis is orthogonal I guess the method name proposed in #88914 of |
779a842
to
1e141c7
Compare
If the approach of "all non-uniform scaling is bad" is taken, then there should be primitive shapes for things like ellipses. Or even better some more generic "oval" shape (like eggs). |
1e141c7
to
e0b7c11
Compare
e0b7c11
to
5489c12
Compare
5489c12
to
c2a1c08
Compare
c2a1c08
to
055a335
Compare
055a335
to
415a32c
Compare
415a32c
to
1d72c7e
Compare
1d72c7e
to
1ac3a93
Compare
Just as an FYI, there are runtime scaling checks happening server-side in the newly added Jolt module, which is a somewhat crude carry-over from the extension. See these methods, these macros and their usage. Jolt provides a However, just relying on As a result, a new method was added to Jolt, called With that said, there are still some people who find this behavior annoying, since it results in significant error spam in situations where you might not necessarily care about that particular problem, so there might be some argument for just ditching these runtime checks altogether and solely rely on node configuration warnings instead, but I would still like to see that these checks be deferred to the physics server in some way, so that we can allow for Jolt's more relaxed requirements around scaling. |
1ac3a93
to
521d957
Compare
521d957
to
f48f4b2
Compare
Fixes #88415, fixes #92205
Previously, the body/shape scale warning code did not handle these cases:
This PR changes the code to check if the Basis is conformal, which handles all these cases. It actually does this twice, another time for the global transform, to ensure that there is no invalid transform inherited from ancestors (we also want the node's local transform to be validated in addition to global).
Also, this PR adds the same checks to 2D, since it was missing before.
Note: Negative scale is allowed in master and still allowed in this PR.
Note: Zero scale is invalid but is not validated in master or in this PR. I don't know if that's worth checking for since it's kinda obvious that it's invalid because most things in 3D are considered invalid if they have an zero scale.