Xith3D physics

I am considering adding physics capability to Xith3d. Like shadowing, you would pick sub-roots of your scenegraph to inidcate the root of an “object”, even if the object is really made up of lots of shapes. You could supply collision geometry or it will calculate a convex hull for the geometry below it. You would also assign a mass to the object so that momentum, friction and inertia can be properly calculated.

You would be able to attach Motions to the objects, which are similar to the movement behavior interpolators of Java3d, execpt that these motions will honor mass, volume, velocity and collisions.

I really don’t want to write a super sophisticated physics engine, but I would like to expose the framework so that people can build on the engine to make it more sophisticated, or even hook in a third-party engine.

Any suggestion on how to begin? Any java physics libraries out there? Any thoughts on this idea?

That is a VERY good idea.

I don’t know enough about physics myself to contribute, but integrating physics straight into the scenegraph (and, in a way, making it all more of an “engine”) would kick ass.

I would avoid tightly integrating the physics into the rendering engine.
As you say people may want to hook in more advanced engines etc… I would add generalized hooks to Xith3D and then build your physics engine using these hooks as a separate layer.

There are just so many things that someone might want to add to a physics/game engine it is of course impossible to think of everything ahead of time. Even thinking of all the needed hooks could be hard. Eg. what about friction, temperature, prevailing winds, ocean currents, gravity forces or radiation levels… all of which could effect movement of game objects or more abstract things related to the game engine like the effectiveness of tractor beams or energy shields…

These would be beyond the scope of a general engine, but they might be needed for specific games and then you would need to plug them in to Xith3D somehow, as long as they can all is cool, but if these attributes have to be accessed via a different mechanism than mass and velocity it could complicate the design.

Maybe much of this ability is already in Xith3D? I don’t know. For instance I remember someone (you?) talking about the political alignment of regions in the game world and other such attributes… where/how would they be stored? If they are stored with hooks into the world geometry could arbitrary physics quantities be stored in the same way?

Maybe some kind of visitor pattern would be a good design for something like this?

Then it just comes down to what should be exposed though ;D