Swing System
The swing logic is controlled by the bIsSwinging boolean that is true whenever the player starts the swinging state. To calculate the logic of the swing, the distance from the player is subtracted by the distance of the line trace hit. This value is used to get the direction of the rope. To calculate the velocity and create the swing movement, subtract the dot product of the velocity and the Rope Direction. This leaves the pendulum motion and simulating a rope swing.
The player can boost the speed of the swing. This simply uses the player's own velocity and adds to the forward vector over time.
The FireHook function uses the camera's forward vector to launch a line trace. The result is stored and the swing logic is triggered if the line trace was successful.
The Swing function uses the Hitlocation as the grapplepoint. It also removes friction to enable a better flow for the swing logic.