DrBibop / RaftVR

A virtual reality mod for Raft
https://www.raftmodding.com/mods/raftvr
GNU Affero General Public License v3.0
8 stars 2 forks source link

feat: Improve Axe and Weapon Immersion #3

Closed danger7789 closed 1 year ago

danger7789 commented 1 year ago

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:

  1. Set a boolean disableHit to true whenever a hit occurs.
  2. Check disableHit during OnCollisionStay which disables multiple hits.
  3. Clear disableHit when we get a new OnCollisionEnter to allow another hit to occur.
    1. 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 👍 .