- Home /
Is there something like a 2d equivalent to the avatar body mask? / Any way to create an animation for an arm attacking that's independent from the body (in 2d)?
Hi there! I'm new to Unity, so I apologize in advance if this question is a bit stupid and the answer obvious.
I'm trying to make a simple fighting game in 2d, using the recently launched native 2d tools. The game uses a classic side view and the characters are made of different parts instead of being just one sprite (think cutout animations). Basically they're head + body and legs + arm holding a sword, stacked in that order and parented to a gameobject.
What I want to know is if there's a way to animate body and arm separately. Is there something like a 2d equivalent to the avatar body mask that exists for 3d? I just want to have the arm in one "layer" and the rest of the body in a different one, so I can create idle and an attacking animations for the arm that are independent from the body, and have the character/body have its own idle, running and jumping animations.
In other words, what I'm asking is if there's a way to make the character attack (swing a sword) while standing still, running or jumping without having to make whole body animations for each combination (running and attacking, jumping and attacking and standing and attacking).
I hope the question was clear enough (english is not my first language), and thanks in advance for any help you could provide!
Answer by Vitor_r · Jan 23, 2014 at 11:06 AM
There is a way, take a look at the Unity 2d Tutorial here and pay attention when they are explaining the animation of the cannon... if im not mistaken (i can't check it now because im at work), he uses a Layer for the animation of the cannon so he animates regardless of the body animation.
Thank you so much! I think I remember watching at least part of that tutorial when it came out, but I completely missed/forgot about that part!
For those wondering, he mentions the animation layer for the bazooka at 10:48 in the video.
looks like the link is not working. Could someone please give me the link of the video that he is talking about?
The video was the Unity 4.3 - 2D Game Development Walkthrough, here: https://youtu.be/4qE8cuHI93c
Answer by Arxot · Apr 17, 2020 at 03:19 PM
I'm interested too! Any new about it in 2020?:) What I would need to is to set up a proper rig 2D model with IK. In order to be able to use OnAnimatorIK() method and manipulate animations in runtime.
There's the 2D IK package https://docs.unity3d.com/Packages/com.unity.2d.ik@3.0/manual/index.html It's in preview like half the packages, and not exactly what you ask for, but could be useful depending on your needs.
com toda certeza a resposta do que ele queria está aqui> com certeza a resposta ao que ele queria está aqui>
Answer by yotam541 · Apr 16, 2020 at 06:57 PM
Is there a solution? The video that @Vitor_r gave does not say anything about it
The link no longer points to the original video, see my reply to hanisherif above for the right link.
com toda certeza a resposta do que ele queria está aqui> com certeza a resposta ao que ele queria está aqui>
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Root motion lost in transitions 1 Answer
Animation plays in preview mode but not max screen? 1 Answer
Animation stops rotation 0 Answers
2D (Movement and Animation) overlaps physics with RigidBody2D 1 Answer