Get half of Length

What I want to achieve is a Grappler Hook, and I have an animation where the hooks “open”. I want that animation to play at the half of the length passed.
Here is what I mean:

:red_square:: Route
:blue_square:: Position where animation should play
← ¹: Hook with unplayed animation
← ²: Hook with played animation.

I know this is a dumb question but, to be sure, how would I do it?

1 Like

I guess dividing the distance between the 2 points

local P1:Vector3, P2:Vector3 = 
local Middle = (P2 - P1).Magnitude/2

if it has to be a Vector3 value

local P1:Vector3, P2:Vector3 = 
local Mid = (P2 - P1)/2
1 Like

Currently I have

local MousePos = Mouse.Hit
HandPos = Character.RightHand.Position
local Orientation = CFrame.lookAt(HandPos,MousePos)

I should do

local Middle = Orientation/2


local Middle = Orientation.Magnitude/2


I assume it works with a Rope and TweenService, right?

local P1:Vector3, P2:Vector3 = Mouse.Hit.Position, Character.RightHand.Position
local Middle = (P2 - P1).Magnitude/2

Animation is played when the length of the rope is equal to Middle.

I play 2 animations on the Hook:

  1. From Hand to Mouse.Hit
  2. Open hooks animation (the middle of length one)

In this case, how would I modify your code to match mine?