Hello. im trying to make a grappling system somewhat similar to Attack on titans. Currenty I have this which is fine and all but i want the strafing / rotating around to be more smooth so that it doesn’t start abruptly.
local function updateGrapple(char, target)
BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BodyVelocity.Parent = char.HumanoidRootPart
BodyGyro = Instance.new("BodyGyro")
BodyGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
BodyGyro.D = 350
BodyGyro.P = 99999
BodyGyro.Parent = char.HumanoidRootPart
grapplingUpdater = game:GetService("RunService").Heartbeat:Connect(function(dt)
if Strafe == "Right" then
BodyVelocity.Velocity = char.HumanoidRootPart.CFrame.RightVector * STRAFE_SPEED
elseif Strafe == "Left" then
BodyVelocity.Velocity = (char.HumanoidRootPart.CFrame.RightVector * - 1) * STRAFE_SPEED
else
BodyVelocity.Velocity = (target - char.HumanoidRootPart.Position).Unit * GRAPPLE_SPEED
end
BodyGyro.CFrame = CFrame.new(char.HumanoidRootPart.Position, target)
end)
end
This is my code, the important parts are in the Heartbeat event.
What i currently have:
What I’m trying to achieve:
As you can see the other example seems to smoothly strafe the character.