I have a sword, with legacy animations for different attacks. Nested within the sword’s children are two overlapping collision detectors, gameobjects with box colliders, kinematic rigidbodies, and scripts for sending information about what was hit. The two hitboxes essentially do the same thing for now, but I decided to include the fact that there are two in case that could be used to determine my problem.
Now, when the sword hits an object while it is not in its default holding animation, the script on the hitbox should let a script on the sword know so that it can preform the result of a succesful attack. This works fine for almost all of my different attacks/attack animations, except one.
An attack called smash, where the the sword begins in an upright position and is swung down about 90 degrees until it is horizontal. The swinging motion occurs over about frame 10 to frame 15.
Because of this, ive set the sword script to only preform the result of a sucessful attack if it is registered from frame 10 to frame 15
My problem is that sometimes the hitbox doesn’t register during the smash attack, seemingly for no reason. However, i’ve determined through vigorous debugging that when the hitboxes dont register, they actually register immediately after frame 15. Which is exactly when the sword animation begins to rest at a horizontal position. It’s also not a matter of the hitbox missing the object because its moving too fast, the hitbox collides with the object without a doubt. I’m not sure why this is happening, as the other attacks involve similar swinging motions, and I could easily fix it by letting my sword script preform the result of a succesful attack from frame 10 to frame 16, But I’m determined to understand why this isnt working.
I also don’t mean for anyone to program my game for me, but I thought there might be a problem immediately obvious to someone else that I wasn’t aware of, or some documentation that might lead me in the right direction. Anyways, thanks for reading all the way to here.