- Home /
Collider/interaction for different animation
Hi, my name is Linh and I am new to Unity. I just started learning about unity 2D about a month by watching videos and have some basic knowledge for beginner, and I still have quite lot to learn. I'm learning by doing it and today I have a question cause I haven't seen any tutorial talking about this.
I'm making a 2D fighting game like street fighter, for practicing and testing my animation and coding that I just learn, and the problem is I'm not sure how to make a character interact normally when they are in some specific animation.
Lets me explain: in the tutorial they teach about animation and animation controller, using sprite sheet to make an animation and how to control it. The problem is that they just do some simple animation and motion like idle. running jumping in which the propotion and the shape of the character are little affected, so we just need to create some box collider to cover it and that is fine. But in a fighting game, in some situation when the character falling on his back or punching something, the shape change so I can't just just a same collider like when they are idling or running. I'm new to this and I dont know how to make the interaction for each animation. I have think of writing some code "use this collider when this animation is played" but that doesnt sound professional. So if someone have experience, please teach me how to do it right. I'm very aprreciated.
Ps: If you don't mind I hope to get to know with some of you. It is nice to get to know with someone who shares the same passion and also I'm learning unity at home and sometime I really need to ask someone about something. Thank you
Answer by Julien-Lynge · Mar 08, 2015 at 09:26 PM
Hi Linh,
Thanks for the message! It's good that you're getting involved with Unity.
Unfortunately, there is no existing 'how to make street fighter' tutorial, and your question is much too large for us to solve for you in a couple paragraphs.
Here's the quick answer: You probably can't do this using sprites, since Unity just sees sprites as an image with pixels, and not as a shape. You'll probably want to use bone animations or child object animations. There's a tutorial series on the Unity website that contains an example of a bean character with this setup: http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview
Once you have that, you can add colliders to the character's arms, legs, weapons, etc., and use Unity's physics system. Of course, you'll have to learn how to use the physics system, but there are tutorials on that as well.
Good luck!
Your answer
Follow this Question
Related Questions
Need help with some OnTrigger Scripting 2 Answers
How to create a collider-trigger that will start an animation when you press E 0 Answers
Possible to stop collider from "popping" through plane when re-centering? 2 Answers
Trigger Animation doesn't work, please help me. 1 Answer
Problem with Reverse Animation 1 Answer