Is it necessary to create a new script, similar to the Weapon Handler, for each body part or weapon that our player needs a hitbox enabled for, or is there a more organized suggestion for how to handle multiple hit boxes in one combo? I’m imagining something like an unarmed attack with a punch and two kicks. Or a sword attack plus a kick at the end. I’m trying to imagine how to expand the learning to apply to things beyond what’s being taught at face value.
I solved this fairly quickly, actually. Just in case anyone else has the same issue, I solved this by making the GameObjects in the WeaponHandler script to be an array of objects, then in the Enable and Disable functions within, I passed through an int to represent the index of the gameobject in the array. I then updated the animation event so the correct game object was being enabled/disabled based on the animation being played.
The only pain was having to look back at which position my hitbox GameObject was at in the array. I’m not sure how this is going to function with future scripts though.
Ultimately, a more modular approach is ideal.
In our RPG: Core Combat course, we introduce a WeaponConfig which manages spawning the actual weapon on the character when weapons change (and manages selection of animations and amount of weapon damage, etc).
Using this system, the HitBoxes will be on the weapon models themselves (or on a blank gameObject for fisticuffs). Then the EnableWeapon and DisableWeapon will just find all the Hitboxes and enable/disable them.
In my personal project, I took a hybrid approach and put hitboxes on the fists and feet, as well as the instantiated weapon. This allowed me to include kicks and punches even when using a regular weapon, and was quite similar to your solution.
Thank you for the follow up. Very insightful. I’m going to check out the RPG bundle once I’m done with this course.
Can you show us the script the way you do it ? beacuse i want to do the same
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.