Today I started to integrate everything with the Ryno Engine, and I created a PhysicsWorld class, which basically handles the process.
I've not yet been able to test it because I was stuck for hours on a problem: how to automatize the contact detection. Until now there were functions like "sphere_and_sphere" or "box_and_sphere". But the engine has a vector of generic primitives, and C++ does not have reflection. In order to avoid two nested switchs I tried different solutions, but I inevitably stomped against some wall.
In the end I gave up at finding an elegant solution, but I managed to write a "clever" switch: instead of nesting two switches, the first one calls a templated function passing the first argument with the correct type. The template function calls the correct function with a second switch.
As soon as I fixed that a new problem arose in the next function, the contact resolution one. I'll continue tomorrow.
Nessun commento:
Posta un commento