Melee weapon hitbox not detect colliders if there is an obstacle near

bitmore

Member
Hi,
I'm using a box collider on character as melee weapon's hitbox.
If there is an obstacle around(marked with red frame and as it shows in the first screenshot the enemy is not fully blocked), the hitbox can't detect the hits.
If I disable the obstacle's collider component at the runtime, then the hits can be detected.

The melee weapon has to collide with the obstacles because I want the character can destroy the props, at the same time I want the enemy can be hit if he is in the attack range.

I tried to increase the Max Collision Count and some other values of the Melee setup but not working.
I don't know what I'm doing wrong.
 

Attachments

  • 222.png
    222.png
    503.1 KB · Views: 21
  • 333.png
    333.png
    159.9 KB · Views: 22
I am not fully sure what you mean. In the screenshot there is no attack situation. Is it about the player attacking the enemy, or the enemy attacking the player?
 
I am not fully sure what you mean. In the screenshot there is no attack situation. Is it about the player attacking the enemy, or the enemy attacking the player?
It's about the player attacking the enemy. The screenshot shows the positions of the sword's hitbox and enemy and the small crate. I think this happens if the enemy gets too close to the crate(the crate has a box collider too), in this situation, the sword's hitbox(the big box collider in front of the player) cant trigger the hit.
 
I just created a video, you can see that if the werewolf stands next to the crate, the player can't hit the werewolf.
 
Where is the collider of your enemy? Is it positioned in way that you can damage it from the back? You can also add a debug statement to the HitCollider method of the MeleeWeapon class to see which object was hit. Maybe around line 814, where the impact event is triggered. As an alternative, you can listen to the "OnObjectImpact" event on the crate and the enemy to see which one was hit.
 
Where is the collider of your enemy? Is it positioned in way that you can damage it from the back? You can also add a debug statement to the HitCollider method of the MeleeWeapon class to see which object was hit. Maybe around line 814, where the impact event is triggered. As an alternative, you can listen to the "OnObjectImpact" event on the crate and the enemy to see which one was hit.
Hi Christian,
I think I found the issue.
As you can see in the screenshot, the CanUse method in MeleeWeapon checks if the collider is moving, this works if the melee collider is on the melee weapon since the weapon is waving while attacking. but as in my post above, my melee collider is on the player, so the collider's position is not changing.
If we can set the collider outside the melee weapon, maybe there should be a option to allow disable the collider Moving check.
 

Attachments

  • 002.png
    002.png
    71.8 KB · Views: 17
Top