From: <ah...@un...> - 2009-11-10 09:04:24
|
Hello, After taking a long and careful look at the source code and thinking about the greater picture, here are my conclusions. I'd like to (1) keep the current dependency tree for the abstract physics layer and (2) go crazy on the multiple inheritances. (1) - The current design is very well thought out and, more importantly, many other parts of simspark expect it. Any major changes in the dependency tree require adjustments in many other parts of the system, mainly the parsers and other plugins that work with oxygen. Also, with an abstract physics layer that stays true to the current design, it should be easy to integrate the current ODE-specific code into it. Any changes to the design require large parts of the current code to be rewritten - I can tell this from first-hand experience because I've been trying to apply the new design for about one and a half weeks before I decided to rethink it, and I still had many unsolved problems despite only focusing on basic functionality. (2) - I think it's pretty easy to argue that multiple inheritances are needed. As far as I know, there are only two ways for an object to call a non-static method: To implement it itself, or inherit from a class that implemented it. So, let's look only at PhysicsObject for now. It's a simple class providing some functionality that is the same for every physics object: finding out which space or world an object is in, or converting its rotation Matrix to something that Salt can work with. All these methods use ODE-specific code, so either every ODE-specific subclass implements it itself, or an ODE-specific superclass is implement that only ODE-objects, but not Bullet-Objects inherit from. The first possibility would generate more than three thousand lines of redundant code - and that's only talking about the ODE-specific part of the code equal for all physics objects. Also, multiple inheritances wouldn't be that convulted. The simple rule would be that every engine-specific class would have to inherit from its parent class, and all engine-specific subclasses of superclasses of its parent class. Sounds confusing, but it's quite easy: E.g. ODEBoxCollider would inherit from BoxCollider (parent class), and since Collider and PhysicsObject are superclasses of BoxCollider, it would also inherit from ODECollider and ODEObject. I will discuss this design with Joschka tomorrow, but you're welcome to tell us what you think, as well. thanks, Andreas |