Adjusted the collision checking to require the user to swing their axe for tree chopping and stab/swing their weapon when attacking.
ie. you can no longer place your Axe in a tree and hold it there for multiple chops, or place Spear in the shark and hold it there for multiple attacks, you must pull the Axe/Weapon out and re-hit for a second action.
Adjustments from #2, instead of just using OnCollisionEnter for the hit logic instead of OnCollisionStay, we leave the main hit logic in OnCollisionStay but also:
Set a boolean disableHit to true whenever a hit occurs.
Check disableHit during OnCollisionStay which disables multiple hits.
Clear disableHit when we get a new OnCollisionEnter to allow another hit to occur.
Note, hit only actually happens once cooldown also ends, which causes the hit sound effect to trigger thus causing the sound and cooldown timer to encourage a user into an optimal chopping / attaching rate 👍 .
Adjusted the collision checking to require the user to swing their axe for tree chopping and stab/swing their weapon when attacking.
ie. you can no longer place your Axe in a tree and hold it there for multiple chops, or place Spear in the shark and hold it there for multiple attacks, you must pull the Axe/Weapon out and re-hit for a second action.
Adjustments from #2, instead of just using OnCollisionEnter for the hit logic instead of OnCollisionStay, we leave the main hit logic in OnCollisionStay but also:
disableHit
to true whenever a hit occurs.disableHit
during OnCollisionStay which disables multiple hits.disableHit
when we get a new OnCollisionEnter to allow another hit to occur.