I'm wondering if it would be wortwhile to generalize Bodies, Joints and Controllers as Actors (maybe with a different name since Actor is often used in game engine code)
This would allow generalizing dependencies between objects: currently joints are destroyed when their bodies are destroyed, but there are some other cases where similar lifecycle dependency might be useful:
* joints destroyed when other joints are destroyed (ex: Gear Joint)
* controllers destroyed when their sensor body is destroyed
* in some cases a whole structure of joints and bodies should be destroyed when a single body is destroyed (in this case, dependencies must be explicitly specified)
Do you think automatic management of this in (Scala-)Box2D would help or is this easy enough to manage in game/engine code?
PS. I'm only thinking of doing this in the Scala port for now, as Scala makes abstraction/modularity easier than C++/Java/.. (don't know about the other languages). Also, the world would still have separate lists for different types of actors, but some functionality would be generalized.
This would allow generalizing dependencies between objects: currently joints are destroyed when their bodies are destroyed, but there are some other cases where similar lifecycle dependency might be useful:
* joints destroyed when other joints are destroyed (ex: Gear Joint)
* controllers destroyed when their sensor body is destroyed
* in some cases a whole structure of joints and bodies should be destroyed when a single body is destroyed (in this case, dependencies must be explicitly specified)
Do you think automatic management of this in (Scala-)Box2D would help or is this easy enough to manage in game/engine code?
PS. I'm only thinking of doing this in the Scala port for now, as Scala makes abstraction/modularity easier than C++/Java/.. (don't know about the other languages). Also, the world would still have separate lists for different types of actors, but some functionality would be generalized.