How can I make my swinging better?

Hey, im trying to make this better


Of course other than animations, vfx and sfx I want to make this be more like the swinging from spiderman games. Heres an example of someone who managed to achieve it https://www.youtube.com/watch?v=1OmuXO6DvpA
I looked around and found Hookes Law. I think I managed to implement it but its not exactly what I want. This is my code

local class = {}
class.__index = class

function class.new()
	local self = setmetatable({}, class)	
	return self
end

function class:Swing(grapplePoint)	
	self.L = (grapplePoint - rootPart.Position).Magnitude
	self.AlignOrientation = Instance.new("AlignOrientation")
	self.AlignOrientation.Attachment0 = self.PlayerAttachment
	self.AlignOrientation.Attachment1 = self.TargetAttachment
	self.AlignOrientation.Parent = rootPart
	self.AlignOrientation.PrimaryAxis = Vector3.new(0, 0, -5)
	self.AlignOrientation.SecondaryAxis = Vector3.new(0, 1, 0)
	self.AlignOrientation.Responsiveness = 30
	
	self.VectorForce = Instance.new("VectorForce")
	self.VectorForce.Parent = rootPart
	self.VectorForce.Attachment0 = self.PlayerAttachment
	self.VectorForce.Attachment1 = self.TargetAttachment
	
	humanoid:ChangeState(Enum.HumanoidStateType.Physics)

		connection = RunService.Heartbeat:Connect(function(dt)
		self.Direction = (grapplePoint - rootPart.Position).Unit
		self.X = self.L - (grapplePoint - rootPart.Position).Magnitude
		self.HookesLaw = self.Direction * (-10 * self.X)
		self.VectorForce.Force = self.HookesLaw
		--rootPart:ApplyImpulse(self.HookesLaw * dt)
	end)

end

return class

Edit: There is more to the code but its just creating attachments and the rope constraint
Any help is appreciated on how to make it better.

1 Like

I think you need to increase the force cap to avoid jerky movements while swinging.

Bumping this because I still want help…