- Home /
HOW TO Manage Hitbox For Weapon Activating During Animation (Great Detail Inside)
Hi, I am making an 3D action game and am tackled with the task of creating good combat like Monster Hunter or Dark Souls.
I already have the animations and am pretty sure I'll keep using colliders unless someone points me to an super efficitve way while staying as flexible as colliders are.
The problem at hand with an example:
"Attack_Animation_1" ("AA1") of "Player_1" is called who holds "Sword_1" ("S1") in his right hand.
"S1" has multiple collideres as hitboxes attached that now have to be activated or deactivated, also colliders specifically for "AA1". Depending of the frame of "AA1".
The actual problem:
Now I need to communicate through "AA1"'s Animation component which colliders of S1 have to activate/deactivate. Meaning a communication(class/script?) between "AA1" and "S1" has to happen.
After that I have to be able to swap S1 with Sword_2 which then has to use the same hitboxes when AA1 is played
This is what I imagine a HitboxManagerClass could handle. I have no idea where to start, though.
Can you help me to find a soloution to the problem? How can I make "AA1" and "S1" communicate and call reactions from the enemy in a timely manner?
TL;DR:
How to manage hitboxes of weapons during animations of the character wielding the weapon
Hurtboxes of enemies and
How to trigger behavior and other animations like subtracting HP and stunning.
How to make the weapon interchangable and keep functionality
Need guide of some sort
My game will be weapon/sword centric and so I need to manage hitboxes on different kind of weapon animations fast and accurately to generate a good player feedback.
Any good source of help would be great!
Thanks in advance!
Answer by Priyanshu · Aug 21, 2015 at 08:35 AM
One way is to activate/deactivate colliders directly from animation.
How to do it:
Click on Sword Object (Which has diiferent HitBoxes as children).
Create new clip. Call it "Attack_Animation_1".
On 1st frame click: Add Property > arrow of hitbox which u want to edit plus sign of IsActive. To add that property inside animation.
Add properties in successive frames. As suggested above.
Thanks, this is a great answer! How can I make the Swords interchangable?
How can this system work when I use Sword_2 which is supposed to have the same properties?
Do u change sprites in sword attack animation or u move the sword object?
If you move the sword object then you can use the same animation for different swords. And just need to change sword sprite of Sword GameObject when using Sword_2.
Well I am working in a 3D-Environment, but the same principle applies. Have a base_sword object and just load the properties and model in.
I think I can work with that. But I'm still curious what other solutions there are.
Thanks a bunch!