Monday 6.6 | Combat, Melee Hit Detection

Platformer Prototype

Starting on this week's focus combat with melee hit detection. Creating a sword with a line acting as the damage dealing section. Raycast based hit detection script for it.

Detection Points Distribution

I created a script that distributes given amount of points on a line constructed of empties. In the video the "detection points" are drawn as spheres on the sword.


Spheres in the picture visualize the line's points.


The position of the "detection points" are saved for the next frame. Then a raycast is shot towards the last frames position, detecting a possible hit. In the video the red rays mean no hit and green ones mean hit.

Day's Work

  • Blender
    • Second attack animation modified to make sword movement look "realistic"
    • Importing only actions in the NLA strips to accelerate iterating
    • Sword modeled
  • Weapon script
    • Distributing points on a line
    • Ray shooting from those points to their old positions
    • Gizmo spheres
  • "Enemy" physics layer