I’m proud to announce that Crimild has (real) physics support now thanks to Bullet. Yay!
To be honest, I’ve been running away from this feature for some time, because I always thought that integrating an external physics engine would be an extremely complex task. Well, I’m happy to say that, once again, I was wrong.
A couple of weeks ago I was reading this fantastic introduction to Bullet by Ray Wenderlich and it made me realize that adding physics support to Crimild would be a lot easier than expected. And it was. Here’s the Bricks demo in action, implemented using Crimild and Bullet:
The current implementation has support for convex and non-convex shapes and also for static, kinematic or dynamic objects, but it’s limited to rigid bodies only. Shapes are built from the actual geometry, which is a slow process but provides accurate results. I’ll improve this in the future to add custom shapes support if needed.
Finally, I refactored the update loop to simulate physics using a constant time and all components now include a ‘fixedUpdate’ method that is executed after the physics step is completed. Since physics run at a constant delta, this could mean that the ‘fixedUpdate’ function is invoked more than once per frame. Check out this great article about how to fix your timestep
BTW, today’s is September 13th so Happy Programmer’s Day!