The trouble with dragon collisions

In my last post, I outlined a few of the projects I have in progress and what it will take to complete them.  One in particular deserves a bit more attention than that, and perhaps even some feedback, in order to get over a major hurdle.  Regarding my Dragon Dozer game, which will be a Unity 3D browser game, the top obstacle I listed was to, “find a way to add realistic collision to animated model.”

Unlike most of the hurdles I’m facing with my other projects, this one is appears to be a literal game killer, at least from my perspective.  The basic element that is essential to my progress is an animated dragon model that the player will hit (or avoid hitting) with projectiles.  Fortunately I have the dragon modeled, textured and animated, and his animations so far are simple.  He’s sleeping.  The main animation is the dragon breathing and swishing his tail, which I’ve already completed and tested in Unity: https://www.youtube.com/watch?v=fy_YQFRJGF4&list=UU8hCAFT0KdXdxReurhU18Pw

My design was to have the dragon register collisions with the projectile as you would expect, accurately, and anywhere on its body.  Ding the wing, the dragon reacts.  Bump the rump, you get the point.  I understand how to add collision meshes to most objects, so I’ve got my projectiles all figured out.  Unfortunately, I didn’t find out until after testing my dragon in Unity, but you can’t add a mesh collider to an animated object.  You can only add primitive colliders (capsule, cube, sphere) to individual bones of the rig, and achieve pretty…lumpy collision with an animated object that way.  This would be adequate where you just want, say, a fast moving NPC to register collision with a projectile enough to simply record a “hit,” but this isn’t an action game, and I actually want projectiles to realistically bounce off every surface of the dragon instead of going through or bouncing off thin air.  That’s kinda the entire point of the game.

So, what to do?  Constructing a group of primitives that is adequately form fitting to the shape of an animated dragon, is proving to be far beyond my capabilities.  For one thing — and perhaps I need to revise my rig and animations anyway because of this fact — my dragon rig has a lot of tiny bones, especially in the tail, to effect the smooth, organic bend that I was going for.  I’ll admit I’m largely self taught on the subject of envelopes and weights, and therefore maybe I’m missing some technique for skinning my rig that would enable my mesh to deform more smoothly with fewer bones, but right now the fewer bones I have, the more angular the mesh deformation I’m getting.  Or maybe I only need more bones in the tail but not elsewhere, as not much of the mesh deforms aside from that.  Either way, I still want (visually) realistic collision on every part of the dragon, and lots of bones makes for an organizational nightmare, because you have to drill down through the rig’s hierarchy in order to apply collisions.  Fewer bones would mean fewer primitives I can use for collision though, so the fit would be less precise.

Now, I do have a low poly set of dragon mesh pieces that I wish I could use for collisions, and it has been a few months since I have attempted to test this out, but I seem to remember that I was not able to use any other mesh at all besides primitives as a collision object for an animation.  Writing this post has already inspired me to set up a quick and dirty new rig and collision mesh set to test this out again, and I hunted down some threads on Unity Answers that support my conclusion that this is the case, so I guess I’ve succeeded in motivating myself to tackle this again, but I’d still appreciate feedback that anyone may wish to offer that might help me get the results I’m looking for.

Advertisements