-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Tidy Joints 3D #44146
Tidy Joints 3D #44146
Conversation
814fea2
to
06a34f8
Compare
Rebased following merge or #44164. |
06a34f8
to
063502d
Compare
Rebased following merge of #44391. |
063502d
to
2b2d10a
Compare
Rebased following merge of #44859. |
2b2d10a
to
0a46818
Compare
0a46818
to
50f27c1
Compare
50f27c1
to
fe8428f
Compare
Rebased following merge of #45852. |
fe8428f
to
a4443e4
Compare
Rebased following merge of #46578. |
a4443e4
to
565e42a
Compare
Rebased following merge of #47942. |
Rebased following merge of #48050. |
If you need someone to test whether joints still work, I can do it after a rebase! If it's just waiting for someone's approval, this does seems like a cleaner and more consistent structure to me (Although I'll be the first one to say that I don't know much about Godot physics, so count that as approval at your peril 🙂). |
That part seems to have been fixed already in
After discussion in a PR review meeting, we decided not to go in that direction. While it's true that Godot tends to have big files with multiple related classes, we tend to go away from that trend and often split files when they become too unwieldy to work with. Here for 2D the "megafile" is fairly short (less than 200 loc header and 500 loc cpp) so this is not a big issue, while in 3D each file in itself is big enough to be standalone. Moreover, the 3D joints are derived from bullet so it's kind of a library in itself. |
This PR also removed a lot of duplicated code for example: godot/servers/physics_3d/joints/godot_cone_twist_joint_3d.cpp Lines 54 to 70 in 20dfa0c
godot/servers/physics_3d/joints/godot_hinge_joint_3d.cpp Lines 52 to 68 in 20dfa0c
and godot/servers/physics_3d/joints/godot_cone_twist_joint_3d.cpp Lines 72 to 85 in 20dfa0c
godot/servers/physics_3d/joints/godot_slider_joint_3d.cpp Lines 60 to 73 in 20dfa0c
The combined file in this PR is only 1946 lines long. If the reverse were true, would there be justification for splitting the 1946 long file into 5 or 6 files?
Arguing to keep the files separate because the origin had them is separate files is a weak argument. Godot has copied the algorithms (and hence the attribution) not the code (e.g. |
Currently, Joints 3D is spread across multiple files that don't fit with the general Godot file structure and the structure is significantly different from Joints 2D. Specifically:
scene/3d/physics_joint_3d
; instead ofscene/2d/joints_3d
Joints3DSW
joints and its utility classJacobianEntry3DSW
are in a separate file in a folder calledjoints
, instead of together as is done in 2D.This PR renames
scene/3d/physics_joint_3d
toscene/3d/joints_3d
and moves all the 3D_SW Joints intojoints_3d_sw
, removes duplicate code, and makes it consistent with Joints 2D.