Bring the Light
Posted October 7, 2018. 351 words.
I teased with an idea, and here is a very basic demo of it complete and released. Just a warning, it runs poorly, looks bad, and isn’t fun to play. Enjoy!
On a more serious note, while this is not the result I wanted I have definitely learned, or at least re-learned a few things. Looking over it, a project like this is likely too big for me, at my current skill level, with the short amount of time I gave myself.
And as a bonus for people continuing to read, I decided to try something simple but at least somewhat interesting. Here is a basic clone of the cult game Katamari Damacy. And by basic I mean it. No fancy mechanics, and the few that are there a crude to the point of barely functioning. But it works, kinda.
Rolling the ball is easy, just apply torque. Joining objects together is a little bit harder. The way I solved this is by using procedural collision meshes. When the ball hits a collectable object that objects parent is set to the sphere, the existing collider is disabled, and the spheres mesh is regenerated. While more complex, this approach is significantly more performant than dragging around a lot of collision meshes.
So, to generate the collision mesh rays are cast from about infinity (or 10000 unity units) towards the centre of the sphere and all collisions with the sphere or children of the sphere are recoded. Then the one furthest away from the sphere becomes part of the collision mesh. Now you may be wondering, why are the rays cast towards the sphere instead of from the sphere? Well if the ray starts inside the sphere it collides with the sphere at 0,0,0 instead of on the sphere’s surface.