Hello community!
So, I am still pretty new to Godot, but I try to learn quickly so I can lay out porting my project, which currently exists in which-shall-not-be-named, to Godot.
Said project has many objects (hundreds) the player can interact with: Grabbing and moving them around, performing actions, modifications, etc. These objects can have different ways they behave, so I am planning to have a base - say "interactable" - which all the different object types inherit from. So when different functionality is required, I can extend the script of the interactable, add to the node structure as needed and it should work fine.
But there is one tiny exception: The vast majority of these interactables will all be a StaticBody3D as their root as they sit still and only need to provide collisions for Ridigbodies. Yet, said Rigidbodies are also meant to be interactables. And I believe this throws my inheritance idea out the window. At least I think so. From what I know (please correct me if I'm wrong) StaticBody3D and Rigidbody3D always needs to be the root of the scenes that make up my interactables and I cannot just swap those out - nor can I make them children of the interactable scene (at least I don't think so).
Right now I cannot really think of a few solutions:
1) Make ALL interactables Rigidbodies and have those that need to be static use the "Freeze" flag to turn them kinematic or static. That gives a lot more flexibility, but I am unsure if doing this will eventually result in a bottleneck that I am not yet aware of. In "other engine" I did go with this solution and it had the nice upside that moving such static/kinematic objects by player would provide basic collision with other Rigidbodies - which wasn't a necessity, but a nice bonus. But again, I am not sure if I will eventually run into performance issues using frozen Rigidbodies for potentially hundreds of objects that might as well be static objects. Does anyone have any insight in that?
2) Have two different interactable bases: interactable_static & interactable_dynamic which extend from StaticBody3D and RigidBody3D respectively. That would require some redundant scripting, but since some extra logic is required to handle these different scenarios anyway, that would not be THAT much of an issue.
3) Instead of relying on inheritance, using composition instead. I am pretty new to this concept and it SEEMS like it was made to solve problems like this, but considering I only have two distinctly different base types, it seems overkill.
I'd be insanely grateful for any help, feedback, other ideas - whatever you got. Thanks in advance!