[Cross post from email@example.com
Jani & Odejava Users,
Do you think there are any ways to improve the current Ode Objects? The
new high level Odejava objects are a very good step in the right
direction however there are still some issues that I feel are holding
them back. The issue I have is that when you create say a Joint object,
the object is added to the Space automatically. I understand this is
due to the C roots of ODE but I feel it would be nice to have an even
more Object Oriented approach.
Here's an example (taken from the CarExample code):
g = new GeomBox("ramp", 80, 32, 2);
g.setPosition(new Vector3f(0, 0, 20));
What this code does is create a new ODE Geom object _AND_ add it to the
current ODE Space. While it is a far cry from using the low level C
calls, it's still not all that intuitive.
Conversely, with say Xith3D or Java3d, you construct your objects and
then add them to a locale/group/whatever manually:
BranchGroup bg = new BranchGroup ();
In other words, Xith3D objects are added explicitly whereas OdeJava ones
are added implicitly.
The Xith3D model has several advantages, not the least being readability
and also that you can add a BranchGroup to one scene - then say ten
minutes later it can be added again to another scene (assuming it was
removed from the first one). With OdeJava one would have to call the
constructor of all those methods again. Like with BranchGroups, Odejava
Geom's would have to be acyclic.
Having Odejava and Xith3D share the same model would also help
I believe this change is more of a design decision than a large coding
effort. As far as I can tell, it wouldn't be hard to refactor the
* Geom.java would need a new abstract method "addToSpace(Space space)"
* GeomBox.java for example would need this change:
Local variables: float sizeX, float sizeY, and float sizeZ in the
constructor would need to be instance variables
* GeomBox.java would need to implement the addToSpace method and have it
contain the Ode.dCreateBox ODE constructor.
So the main changes will be a new method in the Geom's so they can be
added to a Space, and storing the initialisation data in the geom.
What are your thoughts please?