Creating graphics/physics hooks during scene initialization
I'm looking for methods to assist the creation of hooks between a graphics engine and a physics engine when loading a Collada scene, so that the graphical representation continually updates to reflect the state of the physically simulated objects.
There are lots of physics engines and graphics engines available, and Collada support is starting to become commonplace for such engines. However, that is of little assistance when trying to integrate graphics and physics for an interactive simulation. Even though the graphics engine and physics engine can import Collada files on their own, they have no ability to set up the necessary hooks between them. This is of course unavoidable in the general case, but the problem is that it basically means that you are unable to take advantage of their builtin Collada support.
It is possible to let them both read the Collada file separately and then try and traverse their internal structures and create hooks between the physics and graphics, but in the end it will probably be easier to self import the Collada file (using the Collada DOM or FCollada) and generate the graphics/physics scene through their C/C++ APIs.
What I envision is that you would be able to pick arbitrary Collada capable graphics engine A, and Collada capable physics engine B, and make them work together with minimal effort. Some basic integration coding will always be required, but after that you should basically just have to feed them the Collada file to get a simulation up and running. Collada is all about interoperability, and this would take it to the next level.
What would be required to achieve this? Any thoughts or comments?
Re: Creating graphics/physics hooks during scene initializat
If both graphics engine and physics engine use COLLADA-DOM to read the file it is easier: you can re-use the same DOM instance for both to load the data into memory.
Originally Posted by kolis
I've been doing this with my Bullet physics engine and several graphics engines. The code that creates Bullet physics objects from a COLLADA-DOM instance is re-usable. The graphics-physics binding and synchronization (usually mainly update of the world-transform for moving objects) still needs to be done manually, but that shouldn't be too hard. Usually this happens after the physics engine datastructures are initialized.
Hope this helps,