Ryo788

Hey everyone,
For an 2D endless runner game I currently have 2 animations (Jump and Run). The image of the character is being moved up in Spine so I was having trouble attaching a 2D box collider to the Spine (Mecanim) GameObject in Unity. I was going through the posts and I found this post which is the same problem I have.
http://esotericsoftware.com/forum/Modifing-Colliders-to-match-Character-Animations-5608

So I'm just wondering, I looked at different options and the thing that seems to be the easiest is to do is add a Bounding box. However, just to be sure since I only have 1 collider on the player. I should parent the bounding box to my root GameObject in Spine? If I do that the bounding box should follow the character as the jump animation is playing right? Or do I have to adjust the bounding box's location throughout the animation?

Also just to make sure how its done. In Unity on my Spine (Mecanim) GameObject I should Add skeleton Utility -> Spawn Hierarchy -> Follow (Root Only) -> On Spine Mecanim GameObject (Skeleton Utility Bone script) -> Under Bounding box drop down spawn Polygon collider 2D.

Lastly since the Polygon Collider 2D gets spawned as a child of my Spine (Mecanim) GameObject, I should have my Rigidbody 2D component moved to the newly created child GameObject so that collision works with any other collider (e.g: ground).

Sorry if these are simple questions, I'm still a beginner :)

Thanks
Ryo788
  • Posts: 1

Harald

You could simply create a separate GameObject with a BoneFollower component (that is setup to follow a specific bone) and attach a BoxCollider to it, if you don't need the complete hierarchy of the SkeletonUtilityBone setup.

Another way would be to simply switch between two pre-defined colliders at your character root GameObject (by enabling/disabling them) that don't exactly follow your bones and animation, but will feel right and consistent all the time.
User avatar
Harald

Harri
  • Posts: 1032


Return to Unity