Question: Melee Attacking, get target

Hey everyone,
So I’m trying to do melee combat in my game, and my idea is to use a near and radar sensor together, change the distance values depending on the weapon used, then take the nearsensor.hitObject() if that’s possible to send a message to that object which would be an enemy or anything hitable anyway. The message would then trigger blocking logic for the enemy (if it can block, because a tree for instance would be included in this and a tree wouldn’t block). Is it possible to use hitObject for a radar or near sensor? Is there a better way of doing this?
Thanks

just parent a sensor to the weapon, have it detect actors and apply damage, have hitting the shield disable the script for x frames?

Attachments

AttackSetup.blend (466 KB)

Thanks, but I guess my question is mainly does .hitObject[] work with a radar sensor. Because the reason why I don’t want to use collision with the weapon is because I want more precision that isn’t necessarily realistic due to my lack of animating skill, and also the weapon scaling isn’t exactly accurate due to camera perspective, since it’s first person and I have an arm setup instead of a full character.

yes, however it will not detect obstacles, so you can hit people through walls with it,

Oh there probably won’t be thick enough walls then. I might toss in a ray sensor too then to see if it hits something that’s not an enemy.