• Unity
  • Modifing Colliders to match Character Animations

Related Discussions
...

I'm having some trouble with modifying colliders during an animation and I was hoping someone might be able to shed some light on the proper way to approach this. My current development tools are Unity/Playmaker/Spine. I have a character that walks and jumps and does other moves that change his height. When the character jumps he tucks his knees which makes his height dramatically shorter than when he's in a standing position. This is an obvious issue since the collider doesn't scale to match the change in body height during the jump which presents immediate problems when jumping over things. What's the best way to modify the colliders during the jump animations. Should I be using a bounding box in Spine or is it something I should be modifying in Unity? I've attached a screenshot to better illustrate my problem.

As far as "proper" goes, this is one place where there's pluralism. There are many good ways to do it, and many bad ways to do it, but no one perfect way applicable to all games and designs (or design sensibilities). Whichever way you choose to implement this depends on your (good) judgement as the game designer and programmer.

I personally don't like game-logical movements to be determined by the animation data, and prefer discrete states to my main character.
So I would not move my character upward in Spine, I would just apply a velocity or force to the RigidBody in Unity, and just animate the tucking in Spine. Then, I would just switch between two collider shapes: the full height and the tucked shape.

But letting your animation determine logic is something some designers definitely do.
You should also try checking the Unity tutorials. I recall there being a topic there touching on a jump animation causing the character controller collider to shrink. You could probably pattern your implementation after that if you think it makes sense for your setup.

That makes total sense! Thanks for the quick reply. I'll check the Unity tutorial as well.